Add to /etc/mysql/my.cnf:
[mysqld] skip-grant-tables skip-networking
skip-grant-tables — start server without grants
skip-networking — disallow remote connections
Restart service:
sudo service mysql restart
Connect to server:
mysql
Flush privileges:
FLUSH PRIVILEGES;
Change password:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
Or:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('password');
Remove our changes from /etc/mysql/my.cnf and restart service.
Добавить комментарий