Last updated on: November 23, 2019 3:36pm
November 19, 2019 1:32pm - 3 min read
Last updated on: November 23, 2019 3:36pm
A few weeks ago I messed up with MySQL 5.5 that was preinstalled in el capitan system. I wanted to install the latest version of MySQL but I realized I won’t be able to install latest or even recent version as I have an older version of mac; late 2008 model! Then I searched through MySQL website and found a wrong version MySQL-5.7.26-osx10.14-x86_64 which is for mac osx 10.14.XX.
After I installed that version, MySQL didn’t startup and I had to go through lots of shits process and eventually deleted all my databases! Error keeps coming: PID is not found and MySQL.socket is not found type error. I gave up for 2 weeks. Today I again sit down and installed correct version mysql-5.7.16-osx10.11-x86_64 of MySQL for my osx version 10.11.16. And again it works nicely.
What I realized is the correct version of MySQL is important for your OS. After installing the correct version, you need to login to MySQL via terminal. You need to reset your old/temporary MySQL password and create a new password!
An old/temporary password was created by MySQL while it was installing. So keep a note of that password.
Let’s login to MySQL server.
So this is how it goes:
In terminal, type:
mysql -u root -p
It will ask your old/temporary password. Type it. It will show following message in the terminal.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18
Server version: 5.7.16
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Now change the old password to a new password. Type:
SET PASSWORD = PASSWORD('your_new_password');
It will output something like this:
Query OK, 0 rows affected, 1 warning (0.00 sec)
Now you can see your existing databases by typing:
show databases;
You can now create a new database using MySQL command or you can use a GUI app like SequelPro for mac.
While logging to SequelPro, you need to enter your login details of MySQL server.
Username: root
Password: your_new_password
and then click the connect button.
It will connect and you can see existing databases and create a new database easily.
That’s it. Hope it helps someone who was struggling 🙂