Skip to main content

Whenever we reboot our casper server we get the following error in the the console.



"Unable to connect to the database:



Warning: Using a password on the command line interface can insecure.ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1'



Please make sure that the MYSQL server is running and that a firewall is not blocking the JSS Database Utility."



I can cancel the error and restart MYSQL and everything is fine but I can't for the llife of me find the root of the problem.

Are you running mysql on Yosemite? There is a bug with having "Automatically Start MySQL Server on Startup" checked in the System Preferences.



Seeing the same issuse running OS X 10.10 and mySQL 5.6.21. I have a launch daemon set to start it on startup with the command



/usr/local/mysql/support-files/mysql.server start

I had this problem on 10.9.5 server as well, but this seemed to be fixed when we just downgraded my version of mysql to 5.5. Solved a lot of problems for us.



Gabe Shackney
Princeton Public Schools


If you are running OS X Yosemite, you can fix this by creating a LaunchDaemon with the following:



<!--?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>AbandonProcessGroup</key>
<true/>
<key>Label</key>
<string>com.mysql.server</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/mysql/support-files/mysql.server</string>
<string>start</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>


Name it "com.mysql.server.plist" and save it in "/Library/LaunchDaemons" and make sure permissions are as follows:



# ls -al com.mysql.server.plist 
-rw-r--r-- 1 root wheel 519 Apr 23 17:38 com.mysql.server.plist


If not you can set owner & group with the following command:



sudo chown root:wheel /Library/LaunchDaemons/com.mysql.server.plist


And permissions with the command:



sudo chmod 644 /Library/LaunchDaemons/com.mysql.server.plist


And you can test it by using the MySQL System Preferences pane and click "Stop MySQL Server" and then run the following command and it should start it if it launchd item isn't already loaded.



sudo launchctl load /Library/LaunchDaemons/com.mysql.server.plist


Then open the System Preferences -> MySQL pane and confirm its running.



To check that is launchd item is running, use this command:



sudo launchctl list | grep com.mysql.server


Good luck, hope this helps.


FYI...


Reply