无法打开 mysql.plugin 表。请运行 mysql_upgrade 来创建它
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41531225/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't open the mysql.plugin table. Please run mysql_upgrade to create it
提问by Dims
I have downloaded mysql ZIP from here https://dev.mysql.com/downloads/file/?id=467269
我已经从这里下载了 mysql ZIP https://dev.mysql.com/downloads/file/?id=467269
Then extracted it, renamed my-default.ini
to my.ini
, set
然后提取它,改名my-default.ini
来my.ini
,集
basedir = D:\Apps\MySQL\mysql-5.7.17-winx64
datadir = D:\Apps\MySQL\data5717
then started
然后开始
mysqld --console
under admin privileges. All was described here: http://dev.mysql.com/doc/refman/5.7/en/windows-install-archive.html
在管理员权限下。一切都在这里描述:http: //dev.mysql.com/doc/refman/5.7/en/windows-install-archive.html
Unfortunately it prints the following in console:
不幸的是,它在控制台中打印了以下内容:
[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
[错误] 无法打开 mysql.plugin 表。请运行 mysql_upgrade 来创建它。
and doesn't work.
并且不起作用。
回答by Solarflare
You probably misunderstood/skipped point 4 in your list, Initialize MySQL. It means to either copy an existing data directory there or to create a new one, see Initializing the Data Directory Manually Using mysqld.
您可能误解/跳过了列表中的第 4 点Initialize MySQL。这意味着要么在那里复制现有的数据目录,要么创建一个新的目录,请参阅使用 mysqld 手动初始化数据目录。
To initialize a fresh data directory, you basically (after setting your config file) just have to run either
要初始化一个新的数据目录,你基本上(在设置你的配置文件之后)只需要运行
bin\mysqld --initialize
or
或者
bin\mysqld --initialize-insecure
The latter will set an empty root password.
后者将设置一个空的 root 密码。
回答by Kelly MacInnis
If you set datadir to some other location than basedir, like we do, then you have to COPY, not move, the basedir databases there too. Apparently mysqld looks for some of it's own stuff in the wrong place. After the copy you have to change the owner and group of everything you copied to mysql.
如果您将 datadir 设置为 basedir 以外的其他位置,就像我们所做的那样,那么您也必须复制而不是移动其中的 basedir 数据库。显然 mysqld 在错误的地方寻找它自己的一些东西。复制后,您必须更改复制到 mysql 的所有内容的所有者和组。
sudo cp -R /usr/local/mysql/data/* /your/own/data/place sudo chown -R mysql:mysql /your/own/data/place
sudo cp -R /usr/local/mysql/data/* /your/own/data/place sudo chown -R mysql:mysql /your/own/data/place
BTW you can't just change the basedir to match the new datadir after the copy.
顺便说一句,您不能只是更改 basedir 以匹配复制后的新数据目录。