MySQL root password is a security measure that helps protect your MySQL database from unauthorized access. You can change or set the MySQL root password if you are not comfortable with the current password. To change the MySQL root password:
- Log in to your MySQL server.
- In the root of your MySQL installation, locate and open the mysql_secure_installation file. This file contains information about how to secure your server and its contents should be kept secret by mysql administrators. If you lose access to this file, your data could be at risk!
- Copy and paste the following lines into the mysql_secure_installation file: user=root;password=newpassword;flush privileges;flush tablespaces;flush indexes;
Syntax:
Example:
mysqladmin -u root -h host_name password “newpassword”
You will also want to restart the database server after running this command
mysqladmin -u root -h localhost password ws8dr8as3