I just had to re-install mysql and I am having a problem starting it up. It cannot find the socket (mysql.sock). The problem is that neither can I. In my Mac OS X 10.4 terminal, I type: locate mysql.sock
, and I get back /private/tmp/mysql.sock
. It makes sense that the socket file exist in that location, but it actually does not.
How can I find the socket file?
If locate is returning a false location, it must have some sort of memory and probably indexes. How can I refresh that index?
The default location for the Unix socket file that the server uses for communication with local clients is /var/lib/mysql/mysql. sock.
sock is created by the mysql daemon on start, and it is removed (or, becomes un-connectable) if this daemon stops. This message is given by some client process, trying to connect your mysqld on this socket without success. Its most likely reason is that the mysqld doesn't run.
The MySQL server's socket file is named mysqld. sock and on Ubuntu systems it's usually stored in the /var/run/mysqld/ directory. This file is created by the MySQL service automatically.
Check the Unix socket connection from the command line In the command line, run the following command: mysql -u root -p -S /var/run/mysqld/mysql. sock . Type a password for your root user and press Enter .
to answer the first part of your question:
run
% mysqladmin -p -u <user-name> variables
and check the 'socket' variable
This solved my problem
mysql_config --socket
UPDATE
mysql_config can tell us where the file mysql.sock should be, but in my case the file didn't exist. So, I've deleted my.cnf:
sudo rm -rf /etc/my.cnf
And then restarted mysql:
brew services restart mysql
The file was created and mysql is now running well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With