default password of mysql 1

default password of mysql

#The password is empty
#If by accident you set the password and you don't remember it
service mysql stop #Stop mysql service
mysqld_safe --skip-grant-tables & #disable "login"
mysql #Log in into mysql, you should see mysql> in prompt
UPDATE mysql.user SET Password=PASSWORD('new-password') WHERE User='root';
exit; # exit from mysql
mysqladmin -u root -p shutdown # shutdown mysql service
service mysql start # Restart your service

Here is what the above code is Doing:
1. Stop the MySQL service
2. Start the MySQL service without the grant tables (which store the passwords)
3. Connect to the MySQL server as the root user
4. Set the root password to be password
5. Shutdown the MySQL server
6. Restart the MySQL server normally

Similar Posts