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
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