Skip to content

MySQL troubleshooting

Fernando Mendoza R edited this page Dec 17, 2019 · 1 revision

MySQL troubleshooting

In case students have a different MySQL version or lost their root password consider the following recommendations:

Removes existing MySQL installs

 brew remove mysql
 brew cleanup
 launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
 rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
 sudo rm -rf /usr/local/var/mysql

Reinstalls the 5.7 version

 brew install [email protected]
 brew link [email protected] --force
 mysqld --initialize --explicit_defaults_for_timestamp
 mysql.server start # no sudo!

Helps to restart the root password

mysql.server restart --skip-grant-tables

Restarts the password directly in the MySQL tables.

UPDATE mysql.user
     SET authentication_string = PASSWORD('codeup'), password_expired = 'N'
     WHERE User = 'root' AND Host = 'localhost';
FLUSH PRIVILEGES;