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 te
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.
My problem was also the mysql.sock-file.
During the drupal installation process, i had to say which database i want to use but my database wasn't found
mkdir /var/mysql
ln -s /tmp/mysql.sock /var/mysql/mysql.sock
the system is searching mysql.sock but it's in the wrong directory
all you have to do is to link it ;)
it took me a lot of time to google all important informations but it took me even hours to find out how to adapt , but now i can present the result :D
ps: if you want to be exactly you have to link your /tmp/mysql.sock-file
(if it is located in your system there too) to the directory given by the php.ini (or php.default.ini) where pdo_mysql.default_socket= ...
I got the exact path using:
netstat -ln | grep -o -m 1 -E '\S*mysqld?\.sock'
Since this only returns the path and doesn't require any input you could potentially use it in a shell script.
MySQL must be currently running on your machine for this to work. Works for MariaDB too.
I'm getting the same error on Mac OS X 10.11.6:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
After a lot of agonizing and digging through advice here and in related questions, none of which seemed to fix the problem, I went back and deleted the installed folders, and just did brew install mysql
.
Still getting the same error with most commands, but this works:
/usr/local/bin/mysqld
and returns:
/usr/local/bin/mysqld: ready for connections.
Version: '5.7.12' socket: '/tmp/mysql.sock' port: 3306 Homebrew
To refresh the locate's database I ran
/usr/libexec/locate.updatedb