Database/MySQL‎ > ‎

Logging In and Modifying Credentials

In order to login to MySQL with root (the default credentials) you should use the command

mysql -u root

If everything is ok - you should see a command prompt "mysql>"

now you can change "root" password simply by using the following commands :

use mysql;
update user set password=PASSWORD('newpassword'') WHERE user='root';
flush privileges;

NOTE : don't forget to flush the privileges in the end.

In order to login with new password use the following command
mysql -u root -pnewpassword

NOTE: no space between p and newpassword.


Comments