[升级用到]Mysql升级脚本,每次升级均得用到,mysql create user mysql.plugin table.  Please run mysql_upgrade to create it

jackxiang 2010-10-6 22:47 | |
Mysql升级脚本,每次升级均得用到:
./mysql_upgrade -p
Enter password:
Checking if update is needed.
Checking server version.
Running queries to upgrade MySQL server.
......
Upgrade process completed successfully.
Checking if update is needed.
参考:http://dev.mysql.com/doc/refman/5.7/en/upgrading-from-previous-series.html
如果不升级会出现什么情况?尽管运行了,但是用phpMyadmin后会出现如下错误:
MySQL 返回: 文档
#1146 - Table 'information_schema.CHARACTER_SETS' doesn't exist
information_schema这个库,`CHARACTER_SETS`这个表,因为升级后没有这个表了,需要运行./mysql_upgrade -p 在information_schema库里生成一系列的表。


101007 22:30:31 [ERROR] Can't open the mysql.plugin table. Please run the mysql_upgrade script to create it.
101007 22:30:31 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
101007 22:30:31  mysqld ended

再源码下面执行,如下:
linux-Jack-nb4:~/webserver/mysql-5.1.12-beta # ./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/var
Installing all prepared tables
Fill help tables
Linux:
bin/mysql_install_db --user=mysql  --datadir=/data/db/mysql

To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h linux-Jack-nb4 password 'new-password'
See the manual for more instructions.

NOTE:  If you are upgrading from a MySQL <= 3.22.10 you should run
the /usr/local/mysql/bin/mysql_fix_privilege_tables. Otherwise you will not be
able to use the new GRANT command!

You can start the MySQL daemon with:
cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &

Please report any problems with the /usr/local/mysql/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com



Mysql运行Ok了:
linux-Jack-nb4:~/webserver/mysql-5.1.12-beta # ps aux|grep mysql
root      5515  0.0  0.1   2804  1312 pts/0    S    22:40   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe
mysql     5566  0.3  1.6  81984 13132 pts/0    Sl   22:40   0:01 /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --user=mysql --pid-file=/usr/local/mysql/var/linux-Jack-nb4.pid --log-error=/usr/local/mysql/var/linux-Jack-nb4.err --socket=/tmp/mysql.sock --port=3306
前面指定了DB位置,后面就会对于那个--datadir=位置所在:
/usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql-/ --user=mysql --pid-file=/data/mysql-//linux-jack-xiang.pid --log-error=/data/mysql-//linux-jack-xiang.err --socket=/tmp/mysql.sock --port=3306
root      5606  0.0  0.0   1900   652 pts/0    S+   22:47   0:00 grep mysql



在MYSQL启动老失败即:Starting MySQL.Manager of pid-file quit without updating file.[FAILED]
查看错误日志显示:mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
/usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist

Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
InnoDB: The first specified data file ./ibdata1 did not exist:

作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:http://jackxiang.com/post/3603/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!


最后编辑: jackxiang 编辑于2016-9-15 14:41
评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]