MySQL problem >> missing mysql.sock

MySQL on my server is down....

I figured out that the mysqld process isn't running. When I try to run it, it says it can't find mysql.sock

Any suggestions?

Here's what I can't do:
can't be root
don't have physical access (do stuff via SSH)
reinstall MySQL (need to keep the current MySQL databases)

I would also like if someone could post their mysql.sock file, I think that manually creating one will work. Also, I don't want to do touch mysql.sock to create the file because I think that wouldn't work.

run ./configure --help to get to see where you can set
the sock file for mysql.

For recent versions of PHP, you can use "localhost:/path/to/mysql.sock"
in your mysql_connect call to tell it where to find the socket.

Nobody can post you a mysql.sock file, it's a Unix domain Socket file which you _can't_ replicate.

Where is MySQL installed, have you tried running safe_mysqld?

Try executing "safe_mysqld &" from the directory that MySQL is installed in to execute MySQL.

I have tried it. I start it and then I get bunch of errors that say like Access denied....

this is a little bold to try out,

shutdown mysql server

manually remove the mysql.sock file in /var/lib/mysql or whatever directory.

try restart the server.

please revert back if that works

You have to start your mysqld.

If your mysqld is not running you will get a
missing mysql.sock file error.

Maybe your user name to login to mysql in not correct. MySql has a default user name. Unix
and MySql have nothing to do with each others
user names.

Without proper user name login, I get this:

-------------------------------------
# bin/safe_mysqld --log &
1168
# chown: unknown user id mysql
Starting mysqld daemon with databases from /usr/local/mysql/mysql-3.23.52/data
020926 22:24:22 mysqld ended

# bin/mysqladmin version
bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
---------------------------------------------

Try something like:

shell> bin/safe_mysqld -u user_name &

Where user_name is your MySql login name.

To see if mysqld is running type:

Shell> bin/mysqladmin version

You should see something like:

Running threads: 1

mysql.sock is required for mysqld processes to operate. For example, if your mysql.sock file exists in /tmp and you decide to delete all the 'temp files' you will have a problem with mysql :slight_smile:

You should make sure you know which directory that the mysql.sock file is created and make sure the mysqld processes have permission to write to that directory... and make sure that prior mysql.sock files are either deleted or have correct permissions so when another process is started it can overwrite this file.

For example:

Notice that the mysql.sock file is in /tmp and the permission are root.root because mysql is running as root.root. If you are not running mysql as root, then you could have problems writing if another mysql.sock file exists, etc.

My advise is to find out where your system is writing this file, shutdown mysql, delete all the old mysql.sock files, check permissions and restart.

It really depend on where you configure your Mysql to have that mysql.sock at. Most of the time it would be in /var/lib/mysql/mysql.sock but in some case it is in /tmp/mysql.sock. To make it easy, just make a link from /var/lib/mysql/mysql.sock to /tmp/mysql.sock. This would work.

<quote>Try something like:

shell> bin/safe_mysqld -u user_name &

Where user_name is your MySql login name.

To see if mysqld is running type:

Shell> bin/mysqladmin version

You should see something like:

Running threads: 1</quote>

I was having trouble getting the mysql server started and this tip did the trick but i have a question... I have the start mysql option set to yes in rc.config i believe it is, but it doesnt seem to want to stay on... i tried rcmysql start, it would say ;

starting service MySQL
starting mysql-daemon with database from /var/lib/mysql
021103 09:46:32 mysqld ended

anyway, it would statr and stop really fast. i entered bin/safe_mysqld -u user_name & in the console and it started then left the cursor droped down on the next line with no console prompt so i opened another console window typed rcmysql status and it says running, so cool!

What i would like to know is how to make it do that from start up with out having to type bin/safe_mysqld -u user_name & all the time. also is that the proper way to start mysql server or is it just a way to ensure everything should be working fine. If there is a proper way i wouls sur elike to know. Thanks alot!

Cerberus