There’s a strategy to reset MySQL set up on a cPanel server with out reinstalling, however it isn’t beneficial, as a result of doing this may make all databases inaccessible. Nevertheless, we will do that in a essential scenario resembling catastrophic InnoDB corruption. In such conditions, the said purpose is to reset mysql and restore from backups. Resetting the MySQL set up is a drastic step, so it is best to ensure that there is no such thing as a different strategy to repair your downside.
Please notice: cPanel doesn’t assist this MySQL server reset.
To reset MySQL, you want to carry out the next steps.
1) First, you want to take all database backup for safety. Login to the server as a root consumer and given under command to take all database backup.
mysqldump –all-database > all_databases.sql
2) Then cease mysqld.
/and many others/init.d/mysql cease
service mysql cease
3) Now transfer your mysql information listing, and /and many others/my.cnf. You’ll be able to create a MySQL information listing with a timestamp with the next command. In case you are utilizing one other listing like /dwelling/mysql to your mysql set up, you will want to make use of that listing as a substitute, and compensate for this when putting in a contemporary database as effectively.
mv -v /var/lib/mysql,.Backup.`date +%F.%T`
mv -v /and many others/my.cnf,.Backup.`date +%F.%T`
4) Now you will want to create the essential mysql information listing construction with the next command.
Please notice: the above command will ask you to set a mysql root password. We’ll do that by WHM as soon as mysql is working so that you don’t have to set it through the command line. You’ll want to reset the mysql root password by WHM as a result of in any other case, WHM won’t know the foundation mysql password and database options will fail with entry denied from mysql.
5) The subsequent step is to set appropriate permissions on the mysql listing.
chown -R mysql.mysql /var/lib/mysql
6) Now we will begin mysql service.
/and many others/init.d/mysql begin
service mysql begin
7) Now you’ll be able to verify the mysql standing by operating the next command.
service mysql standing
8) Then you want to reset mysql root password by WHM.
WHM >> SQL Companies >> Reset MySQL Root Password
From there you’ll be able to reset MySQL root password.
9) Run the next cPanel scripts to arrange the cPanel mysql databases that cPanel depends on.
10) Eventually, want to revive the databases from the backup and run following command to revive the grants to the database, when you add databases again in for the customers. This can restore all of the cPanel grants and permitting entry to the databases.
/usr/native/cpanel/restoregrants –db=mysql –cpuser=USERNAME –all
In the event you want any additional assist, please do attain our assist division.