MYSQL error:Can’t open and lock privilege tables: Table ‘mysql.user’ doesn’t exist

Published on:
Last updated:

This post is also available in: 日本語 (Japanese)

This error occurred when installing MYSQL from a ZIP file without using the installer on windows7 64bit.
I write it down because it might be useful to someone.

Error details and solution

Can't open and lock privilege tables: Table 'mysql.user' doesn't exist

In my environment, it seems that an error occurred due to wrong setting of path in my.ini file of basedir and datadir.
In the case of windows, it seems that you must write two backslashes when setting PATH.

# These are commonly set, remove the # and set as required.
 basedir = C:\\mysql-winx64\\mysql
 datadir = C:\\mysql-winx64\\mysql\\data

If the old information remains, it will not be reflected, so initialize the MYSQL settings with the following command.

mysqld --initialize

Then try installing MYSQL again.
By the way, MySQL Workbench makes it easy to create and manage MYSQL schemas.

No tags for this post.

About
Kuniyoshi Takemoto is the founder of Amelt.net LLC, and editor of this blog(www.amelt.net).Learn more and follow me on LinkedIn.