How to Change MySQL Root User Password Ubuntu 22.04|20.04

[ad_1]

If you want to change the password of the root user of MySQL in your Ubuntu system, you have to type 3 commands such as sudo mysql, use mysql, AND UPDATE USER SET authentication_string = password(“new_password”) WHERE user = “root”, on the command line.

Ezoic

Through this tutorial, we will show you how to change the Mysql user or root user password on Linux ubuntu using the command line.

How to Reset or Change MySQL Root User Password on Linux ubuntu

Here are some steps for changing or resting the MySQL root user password on Linux ubuntu using the command line:

Step 1 – Login to the MySQL shell as root

First of all open the command line and execute the following command into the command line to access the MySQL root user:

Ezoic

mysql -u root -p

Step 2 – Change the MySQL Root user password

Execute the following commands on the command line or terminal to change MySQL 8.0 user password on the Linux Ubuntu system:

UPDATE mysql.user SET authentication_string=null WHERE User='root';
FLUSH PRIVILEGES;

Replace new_password with your own password:

Ezoic

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new_password';

Step 3 – Restart MySQL Server

Execute the following command on the command line or terminal to restart start MySQL server:

sudo systemctl restart mysql

Step 4 – Verify the new password

Execute the following command on the command line to verify that the new password has been applied correctly type:

Login to MySQL using the new password.

Ezoic

sudo mysql -u root -p

Enter the new password you set before when prompted.

Here is the video guide on how to change MySQL root user password on ubuntu using command line:

Conclusion

Through this tutorial, you have learned how to change or reset the Mysql user password on Linux Ubuntu 22.04 using the command line.

Recommended Linux Ubuntu Tutorials

EzoicEzoic

[ad_2]

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

GSTIN is 03EGRPS4248R1ZD.

Contact
Jassweb, Rai Chak, Punjab, India. 143518
Item added to cart.
0 items - 0.00