# Mysql not started (error 2002)



## rubijn (Dec 29, 2008)

I'm trying to install mysql 5.1 on ovh server (FreeBSD 6.2). The install via /usr/ports/database/mysql51-server/ was ok. 

But when i start the server 
/usr/local/etc/rc.d/mysql-server start
I have no error message but in fact my server doesn't start. 

When i try mysql i have 
error 2002: can't connect to local mysql....

and in the log file
[ERROR] Can't start server : Bind on unix socket: Permission den
ied
[ERROR] Do you already have another mysqld server running...

I have no process mysqld or other in process list ?

If someone could you help me. 

Thanks


----------



## hark (Dec 29, 2008)

You might consider running mysql_install_db manually, if you already haven't. It sounds like there's a permission problem with /var/db/mysql -- is the mysql user able to read/write to this directory?

I realize that the rc script should automatically call mysql_install_db, but I swear it wasn't magically working for me a couple months ago. (Once you've got it working, make sure to clear out the default users and stuff).


----------



## r-c-e (Dec 29, 2008)

Have you added mysql_enable=YES to rc.conf? Are you running the startup script as root/sudo?


----------



## rubijn (Dec 29, 2008)

hark said:
			
		

> You might consider running mysql_install_db manually, if you already haven't. It sounds like there's a permission problem with /var/db/mysql -- is the mysql user able to read/write to this directory?
> 
> I realize that the rc script should automatically call mysql_install_db, but I swear it wasn't magically working for me a couple months ago. (Once you've got it working, make sure to clear out the default users and stuff).



i try mysql_install_db but again some errors
Installing MySQL system tables...
ERROR: 1136  Column count doesn't match value count at row 1
081229 20:32:16 [ERROR] Aborting

The user mysql have rwx in all /var/db/mysql/ ?

I have mysql_enable in /etc/rc.conf and when i test 
/usr/local/etc/rc.d/mysql-server rcvar it find the 
mysql_enable = YES...

I'm a little bit lost...


----------



## r-c-e (Dec 29, 2008)

What does the error log have to say? Located in your datadir.


----------



## hark (Dec 29, 2008)

You might try nuking /var/db/mysql with rm -rf, then re-running mysql_install_db. Obviously, if you're _upgrading_ a MySQL instance, this will delete all your data (though you should have backed it all up before upgrading).


----------



## rubijn (Dec 29, 2008)

r-c-e said:
			
		

> What does the error log have to say? Located in your datadir.



where is this log file your talking about ? 
in /var/db/mysql/myserver.err 
I have this lines

081229 21:25:46 mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
^G/usr/local/libexec/mysqld: Can't create/write to file '/var/tmp/ib0ecLIJ' (Errcode: 13)
081229 21:25:46  InnoDB: Error: unable to create temporary file; errno: 13
081229 21:25:46 [ERROR] Plugin 'InnoDB' init function returned error.
081229 21:25:46 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
081229 21:25:46 [ERROR] Can't start server : Bind on unix socket: Permission den
ied
081229 21:25:46 [ERROR] Do you already have another mysqld server running on soc
ket: /tmp/mysql.sock ?
081229 21:25:46 [ERROR] Aborting

081229 21:25:46 [Note] /usr/local/libexec/mysqld: Shutdown complete

081229 21:25:46 mysqld_safe mysqld from pid file /var/db/mysql/
xxxx.pid ended

when i try to start mysql


----------



## rubijn (Dec 29, 2008)

hark said:
			
		

> You might try nuking /var/db/mysql with rm -rf, then re-running mysql_install_db. Obviously, if you're _upgrading_ a MySQL instance, this will delete all your data (though you should have backed it all up before upgrading).



I try (it's a new server no db to backup)... But without success i have again error 2002 and i can't start mysql..


----------



## Christopher (Dec 29, 2008)

rubijn said:
			
		

> ^G/usr/local/libexec/mysqld: Can't create/write to file '/var/tmp/ib0ecLIJ' (Errcode: 13)
> 081229 21:25:46 [ERROR] Can't start server : Bind on unixsocket: Permission denied



This is the reason the mysql server won't start.

What are the permissions on /var/tmp and /tmp directories?  Does the user mysql have write access to /tmp and /var/tmp?  

Do /var/tmp/ib0ecLIJ or /tmp/mysql.sock already exsist?


----------

