Change MySQL Server password if you forgot it
- Stop the MySQL server if it is running, then restart it with the –skip-grant-tables option.
sudo service mysql stop
sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &
this allows connections without a password but disables remote access
.
- Then connect to the MySQL Server using the
mysql
client:
mysql -u root
- Then run this command to reload the grant tables:
FLUSH PRIVILEGES;
- Now you can be able to set a new password for the
root
account:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
then stop and restart the server
Comments
Post a Comment