BIOS,Windows, Linux, Software,Security, Domains, Web Hosting

Change root or user password on MySQL

Setting a complex password on mysql is very essential, so how can I change the root password on Ubuntu, CentOS, etc. mysql command is a good choose, also we can use mysqladmin command to change the password, here I give a example of using mysql command.

1. First we should login to the mysql server.

2. Type the following command in your command prompt

mysql -u root -p

If you login to the mysql for the first time, the root password should be null, just type nothing instead of pressing Enter key.

3. Select database

mysql>use mysql;

4. Change root password

mysql>UPDATE user SET password=PASSWORD('mynewpassword') WHERE user='root';

5. Change common user password, his name is ohbeast

mysql>UPDATE user SET password=PASSWORD('usernewpassword') WHERE user='ohbeast'

6. Flush and reload privileges


7. Exit mysql


Related Articles


Leave a Reply

Subscribe to BootBeta Comments RSS feed to receive notification of latest comments posted.


  • Enter Email Address:

Recent Post

Copyright@ 2010-2014 Bootbeta All Rights Reserved.
HooBlog Ver 1.5 Build 20140530