Fixing the Table mysql.user Doesn’t Exist Error in Plesk

Fixing the Table mysql.user Doesn’t Exist Error in Plesk

MySQL is one of the most popular servers preferred by database admins. When using MySQL, its common to come across errors every now and then. One such error is the “Table ‘mysql.user’ doesn’t exist” error. When this occurs, the server fails to start. You can access the error in the /var/log/mysql/error.log file and looks like this:

Code:
Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
Its easy to fix this problem. Here are the steps you need to follow:
  • Using SSH, connect to your Plesk account
  • Now open the my.cnf file by executing these:
Code:
vi /etc/my.cnf (for CentOS or RHEL distributions)
vi /etc/mysql/my.cnf (for Ubuntu distributions)
  • Add the following lines under the [mysqld] section:
Code:
[mysqld]
skip-grant-tables
<...>
  • Save the changes and exit
  • Restart the MySQL service with the following command:
Code:
# systemctl restart mysql
# systemctl restart mariadb (for MariaDB users)
  • Now navigate into the directory that contain the daily bumps:
Code:
# cd /var/lib/psa/dumps
  • Restore the database by making use of the latest daily bump. Execute this command to make this happen:
Code:
# zcat mysql.daily.dump.0.gz | sed -n '/-- Current Database: `mysql`/,/-- Current Database:*/p' | plesk db
  • Next, you have to remove the ‘skip-grant-tables’ that you added in the third step
  • Finally, restart the service using the following commands:
Code:
# systemctl restart mysql
# systemctl restart mariadb (for MariaDB users)
Now you shouldn’t get the error message. So that’s you fix the Table ‘mysql.user’ doesn’t exist error.
Author
kumkumsharma
Views
3,703
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from kumkumsharma

Top