一、这个是直接升级,而不是卸载清除低版本重新安装
二、重点是
系统表升级、升级数据字典
[root@localhost /]# /usr/local/mysql/bin/mysql_upgrade -uroot -p
Enter password:
Checking if update is needed.
Checking server version.
Running queries to upgrade MySQL server.
Checking system database.
mysql.columns_priv OK
mysql.db OK
mysql.engine_cost OK
mysql.event OK
mysql.func OK
mysql.general_log OK
mysql.gtid_executed OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.innodb_index_stats OK
mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.server_cost OK
mysql.servers OK
mysql.slave_master_info OK
mysql.slave_relay_log_info OK
mysql.slave_worker_info OK
mysql.slow_log OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Upgrading the sys schema.
Checking databases.
sys.sys_config OK
Upgrade process completed successfully.
Checking if update is needed.
三、旧版mysql5.6的配置文件 my.cnf
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
default-character-set=utf8
[mysqld]
port = 3306
socket = /tmp/mysql.sock
character-set-server=utf8
#下面的第四步会强调datadir = /usr/local/mysql/var 这个的
datadir = /usr/local/mysql/var
四、升级过程
1、执行 service mysqld stop 停止当前mysql服务
2、备份当前mysql5.6
[root@localhost local]# cp -rp mysql mysql_56_old
[root@localhost local]# rm -rf /usr/local/mysql
3、上传mysql5.7.22到我自己定义的目录tigger中进行解压,然后移动
[root@localhost tigger]# mv /tigger/mysql-5.7.22-linux-glibc2.12-x86_64 /usr/local/mysql
我之前mysql5.6保持数据文件的路径并不是默认的/usr/local/mysql/data 在配置文件中修改为/usr/local/mysql/var
配置内容:datadir = /usr/local/mysql/var
所以执行如下语句:
[root@localhost local]# cp -rp /usr/local/mysql_56_old/var /usr/local/mysql/var
[root@localhost tigger]# chown -R mysql. /usr/local/mysql
4、进入目录会发现mysql5.7.22没有my.cnf 那是因为mysql5.7.18后没有my.cnf也可以启动的。后期可以把之前的mysql5.6的修改之后拿过来用
5、启动mysql服务
6、会发现错误日志中有很多错误日志,但是mysql启动时成功的
7、系统表升级、升级数据字典
[root@localhost /]# /usr/local/mysql/bin/mysql_upgrade -uroot -p密码
红色框中的qms20180311是我的mysql5.6中的库
五、补充修复 MySQL 数据库结构错误 – mysql_upgrade升级</a>
MySQL 软件之后都需要执行数据库升级指令?在我进行过的几次软件升级之后,总会在 MySQL 的日志中见到
“[ERROR] Missing system table mysql.proxies_priv; please run mysql_upgrade to create it”之类的错误。虽然这个错误修复起来很简单,却不容易引起注意。
1. 错误描述
我在好几次见到这样的错误提示之后才决定好好看看到底写了些什么。因为网站运行很正常,就心想应该不怎么重要吧。错误提示大致内容如下(已将前导的日期时间略去):
[ERROR] Missing system table mysql.proxies_priv; please run mysql_upgrade to create it
[ERROR] Native table 'performance_schema'.'events_waits_current' has the wrong structure
[ERROR] Native table 'performance_schema'.'events_waits_history' has the wrong structure
[ERROR] Native table 'performance_schema'.'events_waits_history_long' has the wrong structure
[ERROR] Native table 'performance_schema'.'setup_consumers' has the wrong structure
[ERROR] Native table 'performance_schema'.'setup_instruments' has the wrong structure
[ERROR] Native table 'performance_schema'.'setup_timers' has the wrong structure
[ERROR] Native table 'performance_schema'.'performance_timers' has the wrong structure
[ERROR] Native table 'performance_schema'.'threads' has the wrong structure
[ERROR] Native table 'performance_schema'.'events_waits_summary_by_thread_by_event_name'
升级了 MySQL 的软件包,管理数据库的某些表结构发生了变化,所以还需要升级数据库的相关表结构。
mysql_upgrade -u root -p
然后根据提示输入 mysql 的 root 帐户密码,修复过程就可自动运行。此时会有如下形式的提示信息输出:
mysql_upgrade -u root -p
Enter password:
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/lib/mysql/mysql.sock'
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/lib/mysql/mysql.sock'
wp_commentmeta OK
wp_comments OK
wp_links OK
wp_options OK
wp_postmeta OK
wp_posts OK
wp_term_relationships OK
wp_term_taxonomy OK
wp_terms OK
wp_usermeta OK
wp_users OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
看来每次在 Linux 中升级了 MySQL 软件包之后都需要进行类似的数据库升级操作。
IT资讯更多
- 因美方禁令,Adobe 将中止委内瑞拉用户账号和服务,且不退款
- 李国庆采访中怒摔水杯:俞渝用阴谋诡计把我赶出了当当
- 谷歌利用GMS狙击华为Mate 30,华为HMS强势崛起
- 如何有效拦截wps、360、qq弹窗广告?只需这几步,永久关闭流氓行为