If you forget the root password or just want to update, and you are using Mac, this article is right for you.
Configuration:
Software | Version |
---|---|
Macbook | 10.15.6 |
Mysql | mysql Ver 8.0.17 for macos10.14 on x86_64 (MySQL Community Server – GPL) |
Phpmyadmin | – |
Steps:
- Stop your Mysql service
Go to System Preferences > Mysql and stop
Or
sudo /usr/local/mysql/support-files/mysql.server start
sudo /usr/local/mysql/support-files/mysql.server stop
sudo /usr/local/mysql/support-files/mysql.server status
2. Run the server in safe mode with privilege bypass: sudo mysqld_safe --skip-grant-tables
3. open a new window to enter the mysql mysql -u root
4. For mysql version 5.7+
UPDATE mysql.user SET authentication_string=null WHERE User='root';
FLUSH PRIVILEGES;
exit;
mysql -u root
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpasswd';
5. restart mysql services
sudo /usr/local/mysql/support-files/mysql.server restart
Errors
Phpmyadmin doesn’t support caching_sha2_password
ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'yourpasswd';
Reference:
https://gist.github.com/zubaer-ahammed/c81c9a0e37adc1cb9a6cdc61c4190f52
https://stackoverflow.com/questions/49948350/phpmyadmin-on-mysql-8-0