# FreeNAS mysql problem - mysql.sock not found



## kalns (Sep 25, 2009)

Hello, I`m new here and i have some problems with mysql setup on some old box with FreeNAS, i`m so sorry if i post it in wrong place

i`m using newest FreeNAS with FreeBSD 7.2 core

i have successfully installed phpmyadmin, and its working properly, befour that i tryd to install mysql5 and failed serveral times, when opening website it says

```
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' 
(2) in /srv/http/include/database.php on line 24 
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
```

i`ve searched over all folders and did not found mysql.sock, i have read that its created automaticaly, Why myne was not ?

Please help me out, i`m getting frostrated.

ps sorry for my bad language 

Kalns


----------



## DutchDaemon (Sep 25, 2009)

- go to http://forums.freebsd.org/search.php
- enter 'mysql.sock'
- click 'Search now'
- read


----------



## dennylin93 (Sep 25, 2009)

Some possibilities:

You haven't started MySQL.
You changed the location of the socket.


----------



## kalns (Sep 25, 2009)

Hi, and thanks for response, i have readed all 5 or so threads and the problem still exists

/usr/local/etc/rc.d/mysql-server status
mysql is not running.

/usr/local/etc/rc.d/mysql-server rcvar
# mysql
mysql_enable=YES

after installing mysql there was no /etc/my.cnf file, so i created it, and pasted some config i found in thouse threads...

Yes mysql has rw acces on /tmp /var/tmp


```
$ mysql_install_db
WARNING: The host 'w00t.local' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...
Installation of system tables failed!
```

any ideas why its happening ?

edit: Yes i have started it, in rc.conf mysql is enabled,
and no i have not changed mysql.sock location


----------



## DutchDaemon (Sep 25, 2009)

MySQL does not install a 'my.cnf' file that I know of, and certainly not in /etc (ports don't install stuff in the base system). There's a sample file in /usr/local/share/mysql however, with this in it:


```
[mysqld]
port            = 3306
socket          = /tmp/mysql.sock
```

But MySQL should run fine without any .cnf.

All you would need in FreeBSD is mysql_enable="YES", and it will start with a socket in /tmp/mysql.sock and databases in /var/db/mysql, all owned by user 'mysql'.

Are FreeNAS and the FreeBSD ports system even compatible, I wonder?


----------



## SirDice (Sep 25, 2009)

You are probably missing /var/db/mysql. Make sure it's owned by the mysql user.


```
# mysql_dbdir (str):    Default to "/var/db/mysql"
#                       Base database directory.
```


----------



## kalns (Sep 25, 2009)

hmm well there is interesting glich, with freenas web interface i`m broswing folders, and i cant read /var/db directory

```
ERROR(S):

var/db: Unable to read directory.
```

i have just linked /var/db/mysql to /srv/mysql/

any othet suggestions ? 

edit: yes i`m missing that directory, i added basedir but nuthing changed


----------



## DutchDaemon (Sep 25, 2009)

How did you install MySQL? How did it end up in /srv?


----------



## kalns (Sep 25, 2009)

i followed this tutorial
http://www.howtoforge.com/installing-mysql-and-phpmyadmin-on-freenas

just changed default provided directory from /mnt/dynamic/db/mysql to /srv/mysql


----------



## DutchDaemon (Sep 25, 2009)

You do understand that installing MySQL on FreeBSD differs radically from what that tutorial for FreeNAS (which is a stripped-down, altered and customised version of FreeBSD) proposes, and that FreeBSD users that are not familiar with FreeNAS can only offer FreeBSD advice that may not suit your installation at all?

Have you tried http://sourceforge.net/apps/phpbb/freenas/index.php ?


----------



## kalns (Sep 25, 2009)

I partly understand that, yes i have read some of thouse threads, registred and wanted to post there first, but page crashed serveral times in row, ( i was logged in) and so i remebered that i`m registred here, and because freenas has bsd core i thinked that  some one could help me.

At first reading some post here which was with very close problem what i have, thinked "YES this might be it... after few scrolls down, user did not say how exactly did fix it" and so i posted here.



Thanks for Your replays!


----------

