- Server
ubuntu 18.04LTS
- Mysql
mysql-server v5.7
- Error:
- edit mysql config file
sudo nano /etc/mysql/my.cnf
- Add to my.cnf
[mysqld]
skip-grant-tables
- restart mysql
sudo systemctl restart mysql
- login to mysql and run command
$ mysql -u root
UPDATE mysql.user SET authentication_string=PASSWORD('YOURNEWPASSWORD'), plugin='mysql_native_password' WHERE User='root';
exit;
- disable the added lines from my.cnf
#[mysqld]
#skip-grant-tables
- Restart mysql
sudo systemctl restart mysql
- Run mysql_secure_installation and set 'y' for all options
sudo mysql_secure_installation
- check login to mysql
mysql -u root -p
Now login to mysql as user root with new password must be possible.
No comments:
Post a Comment