Feb 26, 2012

MySQL not starting when restoring files in /var/lib/mysql

If you get errors like:


120226  1:54:14 [Note] Plugin 'FEDERATED' is disabled.
120226  1:54:14  InnoDB: Initializing buffer pool, size = 8.0M
120226  1:54:14  InnoDB: Completed initialization of buffer pool
120226  1:54:15  InnoDB: Started; log sequence number 0 44233
120226  1:54:15 [ERROR] Event Scheduler: Failed to open table mysql.event
120226  1:54:15 [ERROR] Event Scheduler: Error while loading from disk.
120226  1:54:15 [Note] Event Scheduler: Purging the queue. 0 events
120226  1:54:15 [ERROR] Aborting


120226  1:54:15  InnoDB: Starting shutdown...
120226  1:54:20  InnoDB: Shutdown completed; log sequence number 0 44233
120226  1:54:20 [Note] mysqld: Shutdown complete

or

120226  1:59:18 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
120226  1:59:18 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120226  1:59:18  InnoDB: Initializing buffer pool, size = 8.0M
120226  1:59:18  InnoDB: Completed initialization of buffer pool
120226  1:59:18  InnoDB: Started; log sequence number 0 44233
120226  1:59:18 [ERROR] mysqld: Can't find file: './mysql/host.frm' (errno: 13)
120226  1:59:18 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)

You need to check the file permissions.

The user and group is mysql:mysql
File permissions are rw for user and group (660)

Solution
chown mysql:mysql -R /var/lib/mysql
chmod 660 -R /var/lib/mysql

No comments: