Monday, September 23, 2013

ERROR 1146 (42S02): Table doesn't exist

So some of you might have run across the following errors when installing MySQL 5.6 :
  • ERROR 1146 (42S02): Table 'mysql.innodb_index_stats' doesn't exist
  • ERROR 1146 (42S02): Table 'mysql.innodb_table_stats' doesn't exist
  • ERROR 1146 (42S02): Table 'mysql.slave_master_info' doesn't exist
  • ERROR 1146 (42S02): Table 'mysql.slave_relay_log_info' doesn't exist
  • ERROR 1146 (42S02): Table 'mysql.slave_worker_info' doesn't exist
You are likely amazed that you see this error on a fresh database install. You are not alone. The issue is fixable though.

The safest thing to do is to reinstall the mysql database via the following command: mysql_install_db
I recently had to do this on every fresh install (yes it happened more than once) of MySQL 5.6 on a Solaris Sparc environment.

You can try to use the following to create the missing tables but I found it best to keep everything clean and ensure all is set up with the mysql_install_db.
Some do recommend the launchpad fix I mentioned above but I like I said I prefer the mysql_install_db to ensure everything is linked installed correctly.

I have other blog posts that include examples on using this command :

Related posts on this topic:
 If you run across this from tables outside of the mysql_install_db scope see Peter's blog post to help get you started: