2

I am currently trying to run mysql server on a mac, but the Start MySQL Server from the preferences pane doesn't work, and neither does starting it from the Terminal. I have found a lot of fixes, but none of them work. This is my first time using MySQL, I have very little (just a bit of Java) programming experience, and this is my first StackOverflow post in a long time (please help me learn if I did it incorrectly!).

I installed this version(didn't use brew): mysql-5.7.21-1-macos10.13-x86_64 My machine is 64 bit

What I've tried:

  1. Uninstalled and reinstalled MySQL using this process:

To uninstall MySQL and completely remove it (including all databases) from your Mac do the following:

Open a terminal window Use mysqldump to backup your databases to text files! Stop the database server sudo rm /usr/local/mysql sudo rm -rf /usr/local/mysql* sudo rm -rf /Library/StartupItems/MySQLCOM sudo rm -rf /Library/PreferencePanes/My* edit /etc/hostconfig and remove the line MYSQLCOM=-YES- rm -rf ~/Library/PreferencePanes/My* sudo rm -rf /Library/Receipts/mysql* sudo rm -rf /Library/Receipts/MySQL* sudo rm -rf /private/var/db/receipts/mysql https://community.jaspersoft.com/wiki/uninstall-mysql-mac-os-x

  1. When I open the folder where mysql is installed, I do not have permissions to open the data or keychain folders. So, I decided it was a permissions problem and tried this: Cannot start Mysql on Mac. When I tried to start the server, I got the following error:

sudo /usr/local/mysql/support-files/mysql.server start Starting MySQL .Logging to '/usr/local/mysql/data/XXXXs-MacBook-Air.local.err'. /usr/local/mysql/bin/mysqld_safe: line 198: 7892 Trace/BPT trap: 5
nohup /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=XXXXs-MacBook-Air.local.err --pid-file=/usr/local/mysql/data/XXXXs-MacBook-Air.local.pid < /dev/null > /dev/null 2>&1 ERROR! The server quit without updating PID file (/usr/local/mysql/data/XXXXs-MacBook-Air.local.pid).

  1. Tried to check the admin version and got the following error:

XXXXs-MacBook-Air:mysql XXXX$ bin/mysqladmin version mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)' Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!

  1. Tried to open /temp/mysql.sock from the command line and got that it does not exist
  2. Tried this:

XXXXs-MacBook-Air:mysql XXXX$ % mysqladmin variables -bash: fg: %: no such job XXXXs-MacBook-Air:mysql XXXX$ mysqladmin variables -bash: mysqladmin: command not found

  1. Tried removing my.cnf per this post and restarted the server

sudo rm -rf /etc/my.cnf sudo /usr/local/mysql/support-files/mysql.server start

  1. Tried these instructions MySql server startup error 'The server quit without updating PID file '

XXXXs-MacBook-Air:mysql XXXX$ ps -ef | grep mysql 501 9173
549 0 11:54PM ttys000 0:00.01 grep mysql XXXXs-MacBook-Air:mysql XXXX$ kill -9 PID -bash: kill: PID: arguments must be process or job IDs XXXXs-MacBook-Air:mysql XXXX$ ls -laF /usr/local/var/mysql/ ls: /usr/local/var/mysql/: No such file or directory XXXXs-MacBook-Air:mysql XXXX$ ls -laF /usr/local/mysql lrwxr-xr-x 1 root wheel 30 Apr 4 22:44 /usr/local/mysql@ -> mysql-5.7.21-macos10.13-x86_64 XXXXs-MacBook-Air:mysql XXXX$ sudo chown -R mysql /usr/local/var/mysql/ Password: chown: /usr/local/var/mysql/: No such file or directory XXXXs-MacBook-Air:mysql XXXX$ sudo chown -R mysql /usr/local/mysql XXXXes-MacBook-Air:mysql XXXX$ sudo /usr/local/mysql/support-files/mysql.server start Starting MySQL .Logging to '/usr/local/mysql/data/XXXXs-MacBook-Air.local.err'. /usr/local/mysql/bin/mysqld_safe: line 198: 9327 Trace/BPT trap: 5
nohup /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=XXXXs-MacBook-Air.local.err --pid-file=/usr/local/mysql/data/XXXXs-MacBook-Air.local.pid < /dev/null > /dev/null 2>&1 . ERROR! The server quit without updating PID file (/usr/local/mysql/data/XXXXs-MacBook-Air.local.pid). XXXXs-MacBook-Air:mysql XXXX$ unset TMPDIR XXXXs-MacBook-Air:mysql XXXX$ mysql_install_db --verbose --user=whoami --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp -bash: mysql_install_db: command not found

And now I'm back to this error:

ERROR! The server quit without updating PID file (/usr/local/mysql/data/XXXXs-MacBook-Air.local.pid).

Please help!

EDITED: I uninstalled and reinstalled with brew. Using these instructions: http://stefan.magnuson.co/articles/osx/reinstalling-mysql-on-osx-with-homebrew/ Now it works.

Leanne
  • 53
  • 2
  • 9

2 Answers2

2

I uninstalled and reinstalled SQL with Homebrew using these instructions: http://stefan.magnuson.co/articles/osx/reinstalling-mysql-on-osx-with-homebrew/ Now it works.

Leanne
  • 53
  • 2
  • 9
0

This small diagnosis worked for me in MAC...

open Your Terminal and use the following command to check all the instances or mysql that are currently running in your machine.

1) ps -ef | grep mysql

If you found any process Id with the above command.

2) sudo kill -9 [PID]

Where [PID] is the process id next to username

now try restarting mysql again using the mysql server pane or go to terminal and type the following command

sudo /usr/local/mysql/support-files/mysql.server start
TanvirChowdhury
  • 2,498
  • 23
  • 28