I recently had an incredibly frustrating time with my MacBook Pro. There were 2 things giving me trouble: I couldn’t run local websites with a database; I couldn’t ssh into my Linode for Bloganueva. I’ve been able to resolve these issues, but it was a horrible time. This post is meant to chronicle what happened leading to these problems and how I fixed them. This is not only for myself, but for those who may also run into these issues. I want this to be a one stop shop because there are so many answers out there, I figured it would be nice to have everything in one place. I hope you find this helpful!
Last week I tried running a local version of my work’s website using Valet to make an update, but I got an error I’ve never seen before. I tried a little troubleshooting, but nothing was working. Then I tried opening the local version of Bloganueva, but that didn’t work either. I opened up Sequel Pro to try some more troubleshooting, but I got this:
ERROR 2002 (HY000): Can't connect to local mySQL server through socket '/var/run/mySQLd/mySQLd.sock' (2).
My boss told me he just ran into this same exact problem. His solution was to wipe his whole computer and start from scratch. I really didn’t want to do that though. I researched a whole bunch of possible solutions, but none of them seemed to be working. I started to realize that I accidentally updated Homebrew without paying attention to what it was doing, and everything broke. My version of mySQL was super old. Homebrew updated it to version 8. I was on some version of 5, I’m not sure which revision it was. There is a huge compatibility issue between version 5 and 8. I tried looking for answers concerning this, but I didn’t find anything. Before wiping my whole computer, updating to MacOS Mojave, and starting over, I followed steps to uninstall Valet, PHP, and mySQL and reinstall everything. I wanted to give it everything I had before I took this extreme step. After using your computer for a while, it’s setup exactly how you want it. Software updates often break things, so you’re afraid to upgrade. That’s why I waited so long to upgrade from Sierra to Mojave. I tried nearly everything to no avail, so I decided to obliterate everything and upgrade. My boss reminded me to make sure I have all my files and folders, even my hidden ones. I did think about them, but ultimately I forgot to back those up. Those included my isa_pub files. Yay! That caused my second problem which I’ll talk about later in this post.
After setting a few things up, I was ready to start installing. I installed Valet and PHP 7.1, and I confirmed I could run local sites that didn’t have databases. I installed mySQL 8, and database websites still weren’t working. At this point I was feeling incredibly frustrated. I was getting an error similar to
#1062 - Duplicate entry '1' for key 'PRIMARY'.
It was one of the same errors I was getting before I wiped everything. I couldn’t really find a satisfiable answer for this problem that didn’t involve messing with my databases. I thought to myself, I wonder if I had a previous version of mySQL installed before. I LISH’d onto my Linode server (because I couldn’t login: details below), and I had mySQL 5 on it. So I knew it must’ve been some version of 5 installed on my machine. I uninstalled mySQL 8, and installed mySQL 5.7. I was FINALLY able to import and use databases in Sequel Pro. However, my websites still weren’t working. I was almost at my whit’s end. Then my boss reminded me that since mySQL requires you to setup a password now, I needed to ad that to my database config files, wherever they were. After this, all of my local websites, databases and all, were working. I was so relieved. Until… I remembered I couldn’t SSH into my Linode server. This was the next problem I had to solve.
When it rains it pours, am I right? I looked all over for solutions again. Tried them. Nothing worked. I tried so, so many things. Nothing was working. I couldn’t believe I came this far, and still not everything on my computer was where I wanted it to be. It wasn’t going to feel the same until I could do this. I FINALLY found the solution that was right for me. I word it like this because there are so many out there that work for others, but not others, you know? I had to change my sshd_config on my Linode server to allow root and password login. After this, I was able to
scp the local keys I generated. THEN IT WAS FINISHED. I felt so damn good after this. This was the last step that mattered to me to make my laptop feel like home again. Sheesh.
I wanted to put this post together to have as a one-stop-shop for an issue like this. Answers are all over. It would have been nice if I only had to go to one page. I hope this helps anyone out there!
Order of events: