How to Set MySQL Root Password in Ubuntu 18.04
Setting a root password for MySQL in Ubuntu 18.04 is essential to secure your database and prevent unauthorized access. Here's how you can do it:
- Log in to your Ubuntu 18.04 server via SSH.
- Once logged in, you can access MySQL by typing
sudo mysql
in the terminal. - Next, you need to switch to the MySQL database by typing
use mysql;
- Now, you can set the root password by running the following command:
UPDATE user SET authentication_string=PASSWORD('YOUR_NEW_PASSWORD') WHERE User='root';
- After setting the new password, don't forget to flush privileges by typing:
FLUSH PRIVILEGES;
- Finally, exit MySQL by typing
exit
.
That's it! Your MySQL root password in Ubuntu 18.04 has been successfully set.
What is the password problem?
The password problem refers to the challenges and vulnerabilities associated with creating, managing, and securing passwords, which often leads to weak or reused passwords and increased security risks.
Generate strong passwords tool
Online web, mobile resources for generating strong passwords...
Did you find this page useful?