mySQL can't connect
mysql unable to connect; MySQL said: Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)
Mac mini, Mac OS X (10.7.3)
mysql unable to connect; MySQL said: Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)
Mac mini, Mac OS X (10.7.3)
See my User Tip on installing MySQL: https://discussions.apple.com/docs/DOC-3082
after that I get this:
Administrators-Mac-mini:~ administrator$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)
Administrators-Mac-mini:~ administrator$
I did not uninstall & start over, just this part:
Create a launchd config file for MySQL:
sudo vi /Library/LaunchDaemons/com.mysql.mysql.plist
Use the following content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.mysql.mysqld</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/mysql/bin/mysqld_safe</string>
<string>--user=mysql</string>
</array>
</dict>
</plist>
(if you are new to vi, type 'i' to enter insert mode. Then ⌘-v to paste the above content. Press escape to get back to command mode. Then type 'ZZ' to save and exit.)
The default path for the MySQL socket is not appropriate for MacOS X. Until it is changed, MySQL will not be able to communicate with PHP should you choose to enable that. Let's fix this now.
Create a config file for MySQL that matches the Apple PHP build:
sudo vi /etc/my.cnf
Use the following content:
[client]
socket=/var/mysql/mysql.sock
[mysqld]
socket=/var/mysql/mysql.sock
Start MySQL:
sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysql.plist
Still No Joy.
Nav
mysqlrplcheck: error: Slave connection values invalid or cannot be parsed.
Administrators-Mac-mini:~ administrator$
Did you remove the old startup item and shut down that instance?
I can't find an old instance, and it wont even start to be able to shut down...
If you followed the standard installation instructions, you would have created a startup item that launched the MySQL server. You will need to remove that Startup Item and kill the server process it started.
Uninstalled, followed your Tip to the letter. Cant login to mysql:
Administrators-Mac-mini:mysql administrator$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)
I din't have anytrouble on my Ubuntu Server. Something about mac tho is diff.
Have you actually installed and started the server?
What do you get when you type:
ps auxww | grep mysql
_mysql 158 0.0 0.5 2669012 39548 ?? S Sun06pm 0:06.79 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/localhost.err --pid-file=/usr/local/mysql/data/localhost.pid --socket=/var/mysql/mysql.sock
root 62 0.0 0.0 2433432 1004 ?? Ss Sun06pm 0:00.03 /bin/sh /usr/local/mysql/bin/mysqld_safe --user=mysql
jdaniel 5269 0.0 0.0 2432764 600 s002 R+ 8:14pm 0:00.00 grep mysql
Administrators-Mac-mini:~ administrator$ ps auxww | grep mysql
administrator 43568 0.0 0.0 2434892 548 s001 S+ 7:27PM 0:00.00 grep mysql
Administrators-Mac-mini:~ administrator$
That will do it. You need to run the server before you can connect to it.
Hi etresoft: I followed your tips from https://discussions.apple.com/docs/DOC-3082 and I bump into the same problem that Navigator500 got. I keep getting the error message, "mysql unable to connect; MySQL said: Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)" . I tried typing "ps auxww | grep mysql" and got the following:
root 576 0.0 0.4 2550132 16544 ?? S 2:17PM 0:01.41 /Applications/TextEdit.app/Contents/MacOS/TextEdit /usr/local/mysql/support-files/mysql.server
root 575 0.0 0.1 2466676 4752 ?? S 2:17PM 0:00.02 sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /usr/local/mysql/support-files/mysql.server
_mysql 221 0.0 2.1 2722944 88948 ?? S 1:55PM 0:01.50 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/Crystals-MacBook-Air.local.err --pid-file=/usr/local/mysql/data/Crystals-MacBook-Air.local.pid
root 114 0.0 0.0 2433436 1004 ?? S 1:55PM 0:00.03 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/Crystals-MacBook-Air.local.pid
user1 11182 0.0 0.0 2432768 596 s000 R+ 2:39PM 0:00.00 grep mysql
Can you give me some guidance on what the issue is? I am a newbie to SQL and programming. Sorry if my questions sound dumb and silly!
What client is giving you this error? It is configured to use e correct path or port?
mySQL can't connect