This blog will demonstrate the method for changing the MySQL root password in Ubuntu 22.04. Let’s get started.
For the purpose of changing the MySQL root password in Ubuntu 22.04, follow the given instructions.
Note: The given method for changing password only implies for MySQL version greater or equal to “8”.
First thing you need to do is check the version of installed MySQL on your system:
As you can see, we have installed MySQL version “8.0.29”:
In the next step, utilize the below-given command for stopping the MySQL service:
Now, the MQL service is stopped:
After stopping the MySQL service, verify its status with the help of the provided command:
The given output indicates that MySQL is currently inactive on our system:
MYSQL server should start without networking checks and granting tables. To do so, set the value of “MYSQLD_OPTS”:
Then head towards the next step.
Utilize the following command for starting the MySQL service
MySQL service is now started:
Again, check the status of the MySQL service to ensure that it is currently active and running on the Ubuntu 22.04 system:
Now head towards the next step.
Write out the provided command in terminal for loging in to MySQL account:
To change the MySQL root password, firstly, it is required to flush all privileges:
Then choose the MySQL database:
After doing so, utilize the “ALTER” command and specify the new password:
Lastly, type “quit” to logout from the active MySQL shell:
In order to restart MySQL database back in “normal” mode, first of all, “revert” the added changes by unsetting the value of environment variable:
Next, revert “MySQL” for removing the set system configuration:
Execute the following “killall” command to kill all MySQL processes:
In the final step, restart the MySQL service so that it can take changes from the configured settings:
Now, move to the next step.
Log in to MySQL by writing out the following command in Ubuntu 22.04 terminal and specify the password you have added with the “ALTER” command:
That’s it. You have successfully changed the password of MySQL:
We have compiled the easiest method for changing the MySQL root password in Ubuntu 22.04.
To change the MySQL root password in Ubuntu 22.04, firstly, stop the MySQL service and unset the value of the environment variable. After doing so, start the MySQL service, log in to the MySQL root account, flush all privileges, choose a database, and use the “ALTER” command to specify the new password. Lastly, revert the database back to the normal mode, restart the MySQL service, and log in with the new password. This blog demonstrated the method for changing the MySQL root password in Ubuntu 22.04.
One of the most critical gaps in traditional Large Language Models (LLMs) is that they…
Canonical is continuously hiring new talent. Being a remote- first company, Canonical’s new joiners receive…
What is patching automation? With increasing numbers of vulnerabilities, there is a growing risk of…
Wouldn’t it be wonderful to wake up one day with a desire to explore AI…
Ubuntu and Ubuntu Pro supports Microsoft’s Azure Cobalt 100 Virtual Machines (VMs), powered by their…
Welcome to the Ubuntu Weekly Newsletter, Issue 870 for the week of December 8 –…