VDS Sphera Knowledge Base
| Main / Browse Categories / MySQL / How can I reset my main MySQL root password? |
|
Note: The PhpMyAdmin ValueApp uses the password that is specified in the /etc/my.cnf file. If you have recently modified your MySQL password
make sure that you update the /etc/my.cnf file to reflect the change.
If you have misplaced your MySQL password and can no longer connect to the MySQL server, this article explains how you can either find the original MySQL password or reset it. Finding the Original MySQL Password Login to your VDS via SSH and view your /etc/my.cnf file. You should see something similar to this: [client] password = YOUR_PASSWORD port = 3306 user = root socket = /var/lib/mysql/mysql.sock"YOUR_PASSWORD" should be the original password that was setup when the MySQL ValueApp was installed. Resetting your MySQL server password 1) Login to your VDS via SSH 2) Stop your MySQL server with either of the following commands: /etc/rc.d/init.d/mysql stop /etc/rc.d/init.d/mysqld stop 3) Make sure that all of the MySQL processes are actually stopped or killed. You can check for running MySQL processes with this command: ps wauxIf any MySQL processes are still running, they will look similar to the following: 2102 32523 ... /bin/sh /usr/local/mysql/bin/safe_mysqld ... 2102 32557 ... /usr/local/mysql/libexec/mysqld --basedir= ...You can kill the processes with the kill command(Note: The second column is the Process ID or PID.): kill -9 325234) Once all of the MySQL processes are killed and no longer running, you can have MySQL start without checking the permissions by executing the following command (Note: Once you execute this command you will have to open a new SSH terminal to finish resetting the password.). /usr/local/mysql/bin/safe_mysqld --skip-grant-tablesOpen a new terminal window and you should now be able to connect to MySQL via the MySQL client utility, using this command: /usr/local/mysql/bin/mysql mysqlThen, execute the following command (Note: Replace YOUR_PASSWORD with your actual password.):
UPDATE user SET Password=PASSWORD('YOUR_PASSWORD')
WHERE Host='localhost' AND User='root';
Then, run the command:
exit;5) Finally, login to your VDS Control panel and restart your VDS.
User Comments
|
||||||||
| No attachments. |
|
|


