Linux 升级 MySQL 5.7

来源:互联网 发布:网络投资挣钱 编辑:程序博客网 时间:2024/05/22 06:45

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
原创粉丝点击