What is the MySQL root password?
MySQL is a database system. A database is a store for your website's information.
The MySQL "root" user is the boss account. It can see and change every database on the server. Its password is the key to all of them.
This is not the same as your server's root login. The server root login opens the whole computer. The MySQL root account only opens the databases. They can have different passwords.
Is there a password already?
On servers with cPanel/WHM, the system saves the MySQL root password in a hidden file. On a plain server, it may be empty or set during setup. Check your welcome email, or ask Hostvento support.
Test your login
- Connect to your server with SSH. SSH lets you type commands on the server.
- Type this command:
mysql -u root -p
This tries to log in as the MySQL root user. It then asks for the password.
- Type the password and press Enter. You will not see the letters as you type. That is normal.
- If you see
mysql>, you are in. Typeexitto leave.
Check the saved password on cPanel servers
- Connect with SSH as root.
- Look at the file that holds the saved login:
cat /root/.my.cnf
This shows the saved MySQL root login. Do not share what you see.
Reset a lost password
Warning: this briefly stops your databases, so websites will show errors. Do it at a quiet time and take a backup first.
- Stop MySQL:
Some servers name the servicesystemctl stop mysqldmariadbormysql. - Start it without password checks:
mysqld_safe --skip-grant-tables & - Log in with no password:
mysql -u root - Run these lines, using your own new password:
FLUSH PRIVILEGES; ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewStrongPassword'; FLUSH PRIVILEGES; EXIT; - Stop the safe mode process, then start MySQL the normal way:
systemctl restart mysqld
On cPanel/WHM servers, you can also change it in WHM. See the guide on changing the MySQL root password via WHM.
Quick recap
- The MySQL root user controls all databases on the server.
- Its password is not the same as your server root login.
- Test it with
mysql -u root -p. - Reset it carefully, after a backup, if you lose it.