Linux 升级 MySQL 5.7

I received the qualys report on the vulnerabilities as below:
Screenshot of Qualys Report
and it seems we will have to upgrade to the latest MYSQL version 5.7:
https://dev.mysql.com/doc/refman/5.7/en/

Backup your DB

[root@machine mysql]# mysqldump --opt -u [user_name] -p [database_name] > [backup_file].dump

Stop MySQL 5.1 and remove it

[root@machine mysql]# yum list installed | grep mysql
[root@machine mysql]# yum -y remove mysql.x86_64

Download Latest MySQL 5.7 and install with yum

[root@machine mysql]# yum install https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm
[root@machine mysql]# yum repolist all | grep mysql
[root@machine mysql]# yum-config-manager --disable mysql55-community
[root@machine mysql]# yum-config-manager --disable mysql56-community
[root@machine mysql]# yum-config-manager --enable mysql57-community-dmr
[root@machine mysql]# yum repolist enabled | grep mysql
[root@machine mysql]# yum install mysql-community-server

Start MySQL 5.7 and check

[root@machine mysql]# service mysql start
[root@machine mysql]# chkconfig --list | grep mysqld
[root@machine mysql]# chkconfig mysqld on

Login in import data

Your temporary password for “root” is here:

[root@machine mysql]# grep "temporary password" /var/log/mysqld.log
[root@machine mysql]# mysql -uroot -p 
mysql> create schema [SCHEMA_NAME];
mysql> use [SCHEMA_NAME];
mysql> source [backup_file].dump;

or you can use mysqldump or mysql from shell

 mysql --default-character-set utf8 -h127.0.0.1 -uroot -p < [backup_file].dump;

Problems

  1. 1548-Cannot load from mysql.proc. The table is probably corrupted
    This is caused by the bug http://bugs.mysql.com/bug.php?id=50183
    The column “comment” is char(64) in MySQL5.1 but shall be text in MySQL5.7, so you should change the type of it.

    mysql> ALTER TABLE `proc` MODIFY COLUMN `comment`  text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL;
    ERROR 1067 (42000): Invalid default value for 'modified'
    mysql> ALTER TABLE `proc` CHANGE `modified` `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
    Query OK, 5 rows affected, 1 warning (0.01 sec)
    Records: 5  Duplicates: 0  Warnings: 1 
    mysql> ALTER TABLE `proc` MODIFY COLUMN `comment`  text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL;
    Query OK, 5 rows affected (0.01 sec)
    Records: 5  Duplicates: 0  Warnings: 0
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值