Could not connect to database: Can't connect to local MySQL

Support and queries relating to all previous versions of ZoneMinder
Locked
Adam
Posts: 3
Joined: Thu Jun 23, 2005 10:58 am
Location: POLAND

Could not connect to database: Can't connect to local MySQL

Post by Adam »

Somebody HELP me..

Could not connect to database: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I was searching everywhere but couldn't find the solution for this error.
Apache + PHP is working fine, MySQL is running (I checket by 'ps -A' & 'mysqladmin') however there is still this shit on my screen..
User avatar
Blazer
Posts: 234
Joined: Sun Jun 05, 2005 12:57 pm

Post by Blazer »

try restarting mysql so that it recreates the socket file in /tmp
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

The problem is that your mysql installation and the php-mysql used by apache disagree about where the socket file is. You need to change one or the other so that they agree, or symlink the sock file so it appears in both locations.

If you google for your error message then you will many pages that explain this in more detail and which will probably be more helpful than here as it's not a ZM issue per se.

Phil
Adam
Posts: 3
Joined: Thu Jun 23, 2005 10:58 am
Location: POLAND

Post by Adam »

I work on Ubuntu distro (based on debian), I symlinked it using: "ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock"
I'm not sure how to restart MySQL so I restarted my OS, however I'm still getting this error. Could You tell me what exactly should I do to change it?

THX 4 fast reply
Baylink
Posts: 338
Joined: Sun Jun 19, 2005 3:19 am

Post by Baylink »

I'm not sure you can symlink a socket; if they're on the same filesystem, try a hard link.
Adam
Posts: 3
Joined: Thu Jun 23, 2005 10:58 am
Location: POLAND

Post by Adam »

I fixed it, by adding --with-mysql-socket='path_to_mysql.sock' atribute while making './configure'


Now I have next problem, how to add web user and web group in apache:: 'apache' & 'apache' :?
Locked