Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL does not start when upgrading OSX to Yosemite or El Capitan

I know similar questions exist, such as MySQL with MAMP does not work with OSX Yosemite 10.10. However, I do have MAMP, nor XAMPP installed on my computer.

When I try to start mySQL from the PrefPane, nothing happens.

When I try to start mqSQL from the command line via sudo /usr/local/mysql/support-files/mysql.server start I get:

Starting MySQL . ERROR! The server quit without updating PID file (/usr/local/mysql/data/adamg.local.pid).

Any and all help would be appreciated. I can supply any file output necessary.

like image 506
Adam_G Avatar asked Sep 20 '14 23:09

Adam_G


People also ask

Why is MySQL not opening on Mac?

The reason behind the MySQL Workbench client not working can be many. It can be because your macOS version is not compatible with the version of the Workbench that you downloaded, or maybe because the version of Python installed on your macOS is not compatible with the version of Workbench you have downloaded.

How do I start MySQL on OSX?

Open macOS system preferences and select the MySQL preference panel, and then execute Start MySQL Server. The Instances page includes an option to start or stop MySQL, and Initialize Database recreates the data/ directory.


2 Answers

Open a terminal:

  1. Check MySQL system pref panel, if it says something along the line "Warning, /usr/local/mysql/data is not owned by 'mysql' or '_mysql'

  2. If yes, go to the mysql folder cd /usr/local/mysql

  3. do a sudo chown -R _mysql data/

  4. This will change ownership of the /usr/local/mysql/data and all of its content to own by user '_mysql'

  5. Check MySQL system pref panel, it should be saying it's running now, auto-magically. If not start again.

  6. Another way to confirm is to do a

    netstat -na | grep 3306

It should say:

tcp46      0      0  *.3306                 *.*                    LISTEN 

To see the process owner and process id of the mysqld:

ps aux | grep mysql 
like image 149
Tommy King Avatar answered Oct 02 '22 16:10

Tommy King


Long story short you need to create a launch file. So, from Terminal:

sudo vi /Library/LaunchDaemons/com.mysql.mysql.plist

(If you are not familiar with vi, then press i to start inserting text)

This should be the content of your file:

<?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> 

press esc then : wq!enter

Then you need to give the file the right permissions and set it to load on startup.

sudo chown root:wheel /Library/LaunchDaemons/com.mysql.mysql.plist  sudo chmod 644 /Library/LaunchDaemons/com.mysql.mysql.plist  sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysql.plist 

And that is it.

like image 27
Ares Avatar answered Oct 02 '22 17:10

Ares