This is not a post that most of my readers will generally need to worry about, but instead this is more of a PSA for those of you that are running MacOS Sierra and are web developers. Currently, as of beta4 of the developer preview of MacOS Sierra, there are problems when downloading the latest version of MySQL server.
What We Know
I have talked to other developers running this version of MacOS and confirmed that this is an issue system wide and not isolated to my machine. Here is what I know so far:
- This problem occurs when installing via the install package distributed from the MySQL Community site
- It appears to be stalling at about the 95% mark of the install
- It prevents your computer from safely rebooting (you must force a hard reboot by holding down the power button).
- Force-quitting the installer does not kill the install process (it seems to run in the background
- It prevents you from installing older versions of MySQL or “re-installing” MySQL
What Works
It does appear that the problem is not with MySQL 5.7 itself, but rather with the install script. This assumption is made because it appears those users who had successfully installed MySQL 5.7 on previous versions of MacOS and then upgraded to MacOS Sierra are unaffected. The database itself seems to work, it is the install process that breaks. I hope this helps any Oracle tech reading this right now.
I noticed the problem because I had wiped my harddrive clean before upgrading. So a re-install was necessary for me.
Older versions of the installer also seem to work. I was able to install the “latest” version of 5.6, but not any version of 5.7.
I need MySQL, What do I do?
Right? We all need a little MySQL in our lives. For those of you that make a living by developing web apps that run off Mysql in the background (oh right, thats me!) then you still need to find a way to make this work. Luckily for you, some poor soul (that’s me again…) is about to open up the kimono and tell you all my secrets.
Hint: you and your terminal need to be BFF’s to continue.
Step 1: Kill MySQL Install Process
- Press Command + Option + Escape (all together like they are having a three-way) and kill your “installer” process.
- Close everything on your computer and then hold down the power key until the last whisper of life hisses out of your Mac.
- Pray to whatever Deity you pray to, that everything is going to be ok
- Press the power button again to awaken the beast
Ok, so that might have been drawn out, but I am getting to the point I am bored, so I had to entertain myself. I promise the next part is far more important.
Step 2: Remove (“Uninstall”) any sign of MySQL
So here is the deal, you have 98% of MySQL installed right now on your computer. The problem is that without that extra 2% you are pretty much screwed. Ok, actually that is putting it too nicely, you are completely fucked! It won’t work at all, there was even this guy once that tried to make it work and failed miserably (oh shoot, that idiot that thought it might work was me again).
Alright, now let’s perform the exorcism of MySQL 5.7!
Stop MySQL first if you can (I couldn’t my computer started to hang again)
In your terminal type these commands, in this order. One line at a time. No one likes someone who rushes through these things that need a little patience to happen (just ask your girlfriend/wife).
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
nano /etc/hostconfig
This step will open a text editor inside of your terminal, you want to delete the line that says MYSQLCOM=-YES-
if you have one. When you are done you can press Ctr+X and then Y to confirm save and then press ENTER to save again.
Yes I recognize someone will want to use vim or emacs and I really don’t give a shit. Go ahead and use them. Please don’t tell me how much better they are then Nano, because I know they are better, Nano is just simpler for those that have never used a terminal editor before.
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*
That is it! You are successfully uninstalled. Those last three statements that use the term “Reciepts” in the command are especially important to do, because they are what tells the next installer we are about to use that there is already a version of MySQL installed. If you don’t delete those (thats what our commands are doing is deleting them) then the next installer won’t let you use it, thinking that MySQL is already installed. This removes it without a trace.
Step 3 – Install MySQL v5.6
So now we are going to install version 5.6 instead of 5.7. Unfortunately that means you won’t be making any JSON columns anytime soon, but then again I guess we survived (barely…) for 20 years without them. Glad Oracle finally got around to it.
I digress…
Go to the MySQL Community Site and Download version 5.6 instead. This will install fine and hopefully soon, an Oracle technician will knock on my door and tell me that they got version 5.7 working and I can upgrade. Actually please don’t do that Oracle, do not knock on my door. That would be creepy. But you can leave a comment below if you like.
This is where you install version 5.6 if you missed the link above because you were too lazy to read the whole article and are skimming:
Success?
If you found this helpful, I would love the comments below letting me know that this worked and telling Oracle that this is really a problem.
I just spent the last 5 hours swearing at apple, oracle, mom and dog until I stumble upon this post. Thank you very much Sir. Saved my day and a MacBook Pro to be thrown off a really high cliff.
I’ll take your 5 hours at this point. I wasted a couple days thinking it had to be something stupid on my part. The sad thing is that it’s been almost 6 months since this post and the problem hasn’t even seen progress or attention. There should at least be a warning on the Oracle and MySql Sites
Lol, well glad you finally found me.
5.6 hangs my reboot/shut down too, I must stop mysql process for it to work properly
You can force kill your computer if you really have to. (Hold down the power button for 5 seconds).
Very helpful, thank you. Just FYI, I upgraded from El Capitan to Sierra with MySQL 5.7 previously installed. Everything seemed to work but I could not reboot or shut down my MBP after the upgrade. It would look like it was shutting down but never get beyond the black screen and the Apple light on the laptop lid would never, ever go out. Only resetting via the power button would work.
After manually stopping MySQL and disabling ‘Automatically Start MySQL on Startup’, reboots and shutdowns worked perfectly.
Will follow your instructions on removing 5.7 and installing 5.6.
Yes this is almost exactly what happened to me. It is a horrible glitch. I was able to eventually reinstall through homebrew and it didn’t break my computer.
Homebrew or die! <3
maybe … when you have mysql 5.7.12 installed and update to Mac OS Sierra 10.12.1 the PID cannot be found and starting mysql stays for ever. I updated Mac OS Sierra 10.12.1 to PHP 7.1 and after a reboot … i am good!
mySQL is running in the System Preferences. did not need to stop start mySQL …. so now my websites (WordPress) and OWNCloud (Cloudsolution 24Tb) is running again for over more than an hour … it looks that it is working? Somebody did the same?
Oh glad to hear that works. This will be good advice.
Thank you, It works for me also!
I’ve had 5.6 running with Sierra for a while, but often have to reboot my machine because MySQL dies/vanishes & the pref pane can’t start it back up.
I had problems installing MySQL 5.7.17 to use the temporary password. I used to login MySQL workbench and the temporary password worked and changed to a new password. And 5.7.17 is running on MacOS Sierra version 10.12.2 now. Oh dear, it took me a bloody whole day to figure it out. Damn it.
Thank you so much sir
I almost killed myself from this issue…
I am so glad that my mac is okay now.. though I’m afraid to go back and attempt to install 5.6 XD
Thanks for this post. FYI I also had issues with the latest stable build using homebrew install, but 5.6 is running fine so far. Cheers!
Thank so much, I stayed furious after update OSX Sierra, breaked down all my set!
I came across your article before I installed 5.7… do you happen to know if the issue has been fixed yet or not?
OMG. Thank you so much for this. I was on Yosemite and had a problem installing recent version of MySQL, then upgraded to Sierra and things got worse.
Until I came across your post. Well done, thanks again!
The problem is the file Library\LaunchDaemons\com.oracle.oss.mysql.mysqld.plist (Autostart for mysql).
remove the file,restart, and it will shutdown graceful afterwards. Drawback is to have mysql start manually after reboot via control panel. Its a known bug in Sierra, but hard to find. Took me 5 hours to figure out..
Who does this?
rm -rf ~ / Library / PreferencePanes / Mi *
??
Lol you are removing anything that starts with the “My” in that folder. This is for all the MySQL stuff. Just a handy tip 🙂
I think Rodolfo might be implying that removing anything that starts with those two letters could be a little risky for people that are just blindly running those commands. Personally, I’m not sure how many applications store things in PreferencePanes that match that pattern, but seems very possible.
The suggested line could add a few more letters to be safe.
I think Rodolfo might be implying that removing anything that starts with those two letters could be a little risky for people that are just blindly running those commands. Personally, I’m not sure how many applications store things in PreferencePanes that match that pattern, but seems very possible.
The suggested line could add a few more letters to be safe.
Pingback: MySQL 5.7 Prevents Safely Reboot MacOS Sierra - Man Page
The steps on this page were a life-saver for me. 🙂 I wasn’t aware of what 5.7 would do to my Sierra machine and had installed it (not good). Following the steps here, and installing 5.6, all is well again. Thank you for posting this.
This didn’t work for me (Mac OS 10.11.6 El Capitan). I tried it twice. No luck 🙁
Hi,
I was facing a similar issues with upgrade to OS Sierra and I follwoed the steps described in the article. I installed mysql 5.6 and restarted my Computer but “Start MYSQL Server” from Preference Pane is still not working. Can someone help me with that.
I have been trying to get 5.7 to work for the past 3 days and FINALLY I find your article. Thank you sooo much!!!
also did not work for me… after restarting it’s not auto starting at login and the start button is not working. Ver 14.14 Distrib 5.6.31, for osx10.8 (x86_64)
after following your instruction and install version https://cdn.mysql.com//archives/mysql-5.6/mysql-5.6.31-osx10.8-x86_64.dmg. I receive the following error message: ERROR 1045 (28000): Access denied for user ‘pouranetcheson’@’localhost’ (using password: NO). Please let me know how to resolve this problem. I am new to mysql .
mysql 5.7 works on 10.12 just needed to `mysqld stop` , then `mysql.server start`
check https://stackoverflow.com/questions/15016376/cant-connect-to-local-mysql-server-through-socket-homebrew/16203141#16203141
I happen to be one of the lucky fellows who saw this before attempting 5.7..So i’m freaking greatfull
The .dmg for MySQL 5.7.20 works on Sierra. I, too, made a fresh install of Sierra, and sadly forgot that all the previous setup was lost. Still need to fix the path…
so 5.7.20 works well for Sierra, right??
You’re the man!
Solved my problem. Amazing. Thank you very much. You are the guy who is right.
:)
Very happy 5.6 is working now on my Sierra Mac, after 5.7 not working, and the Preferences Pane for MySQL not working. Many thanks.
thanks so much! I tried so many methods to fix, but all is invalid, and your solution is so great. I just directly change
the version to 5.6….. it works!!! thank but I still don’t know why.
Thanks a lot.. This helped me big time!
Pingback: Fix External Monitor Blurry Fonts After Upgrading to macOS Sierra | iOS Insight
Thanks, I thought the problem was my machine.
Thanks, I thought the problem was in my machine.
You saved my day.
Never been more grateful! Worked like magic!
Cannot thank you enough! Worked like magic!
Awesome!! Thank so much!!
Thank You so much man!
I did your tutorial on “How to make a blog with Laravel” and installed the latest version of MySQL, had a lot of trouble with it and now read this article and did what you said.
But I don’t know how to get all the tables back to newly installed older version of MySQL. If i type php artisan migrate, it gives me errors like:
In Connection.php line 664:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘users’ alre
ady exists (SQL: create table `users` (`id` int unsigned not null auto_incr
ement primary key, `name` varchar(255) not null, `email` varchar(255) not n
ull, `password` varchar(255) not null, `remember_token` varchar(100) null,
`created_at` timestamp null, `updated_at` timestamp null) default character
set utf8mb4 collate utf8mb4_unicode_ci)
In PDOStatement.php line 107:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘users’ already exists
In PDOStatement.php line 105:
SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘users’ already exists
, but there were a lot more tables like posts and a lot migrations, but they do not appear in the database..
Thanks, this resolved my issue. I installed MySQL 5.7 and then upgraded to Sierra. 5.7 ran fine for six months and then died for some reason. After chasing the issue for hours, I found this page and it resolved it right away. Thanks!
Wow glad to hear it saved your day. Same thing happened to me.
you’re MySQL
bless up….it worked
How long it takes to be a good programmer?
sen varya sen dünyanın en bebiş adamısın 😀
We’re just a few days from this post’s second anniversary and this problem appears to be exactly the same. Appalling.
Anyway, here’s what’s different on High Sierra with MySQL 8.0.12.
* The ‘StartupItems’ directory is empty, instead find the plist file in /Library/LaunchDaemons
* starting with Yosemite there is no /etc/hostconfig file (I think with no replacement file)
* Also find the XML dictionary corresponding to the bad install in /Library/Receipts/InstallHistory.plist and delete that.