Forgot MYSQL Password
The MySQL password is stored in a different place than other system and user accounts and passwords. For this reason, it is set when you first implement start MySQL. Even though the administrative user of MySQL is called root, it is a good idea to use a different password for the MySQL for the root user and a separate password for the root user of MySQL.
Resetting the password for root for MySQL will break any applications that use this account. For this reason and other security reasons, it is best to set up applications to use a separate account for database manipulation
Recover Lost Password
Log into the command line of ClearOS using one of the following methods:
From the console of the server, select one of the available command line consoles (Ctrl+Alt+F2, Ctrl+Alt+F3…)
From Windows, download the Windows installer of PuTTY
and SSH to the IP or hostname of the server
From a Mac or Linux/Unix workstation, use the built-in terminal application. On Mac this is found in Applications » Utilities » Terminal. SSH to your server by running replace ip_address_or_hostname):
If this is the first time you have logged into your server through this manner, you will be prompted to accept the identification of this server. Once you do this and are logged in, perform the following commands to reset the administrator password.
service mysqld stop
This stops the mysql service.
/usr/bin/mysqld_safe --skip-grant-tables &
This starts the MySQL daemon in the background and skips the authentication mechanisms.
Starts the commandline version of the MySQL client. Your prompt will change from [root@server ~]# to mysql>.
MySQL uses a command language and syntax that is very specifically formatted. Many of the commands must end in a semi-colon. The syntax can also use parenthesis, double-quotes, and single quotes.
This changes the commands to be issued from the 'mysql' database which is the database that mysql uses to run internal operations including user permissions and rights.
update user set password=password('newpassword') where user='root' and host='localhost';
This command sets the password for the root account to be newpassword. Feel free to change the syntax or use WebConfig to change it again later.
This command reprocesses the privilege database and applies the change you just made.
This will exit the text based mysql client. Your prompt will change from mysql> to [root@server ~]#.
service mysqld stop
This stops the permission-disabled version of the database that we are currently running. Alternately, you can stop MySQL from the Webconfig.
service mysqld start
This starts the MySQL daemon in its default mode which has all the permission structure in place (only this time you now know what the password is for the root account :) .) Alternately, you can start MySQL from the Webconfig.
This exits your logged in session from the console or from SSH.