Change a Password for MySQL Root User on Linux

by Ismail.EL
0 comment

1. What is Mysqladmin :

Mysqladmin is a command-line utility the comes with MySQL server and it is used by Database Administrators to perform some basic MySQL tasks easily such as setting root password, changing root password, monitoring mysql processes, reloading privileges, checking server status etc.

2. Method N° 1 : Change a Password for MySQL on Linux via Command Line :

Step 1: Connect to your database server:

First we’ll login to the MySQL server from the command line with the following command:

Enter the administrator password you set up during installation.

Step 2: Switch to MySQL database :

After connect to MySQL server with root you should switch to the appropriate MySQL database with the following command:

Step 3: Update the password for MySQL  root user:

Next we’ll update the password for MySQL root user. Be sure to replace your_new_password with the actual new password:

Note: You can change the password for any user with the above command. Simply specify that user’s username in place of root

Finally, reload the privileges and exit MySQL:

3. Method N° 2: Use mysqladmin command to change root password :

if you want to change (or update) a root password, then you need to use the following command:

4. Conclusion

In this post, i have explained how to Change a Password for MySQL Root User on Linux.
If you have any questions or feedback, feel free to leave a comment.
As always, if you found this post useful, then click like and share it 🙂

19270cookie-checkChange a Password for MySQL Root User on Linux

Related Posts

Leave a Comment