MySQL 5.7安装、升级笔记分享:
卸载当前的 MySQL
查看当前 MySQL 版本:
[root@coderknock ~]# mysql -Vmysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (i386) using readline 5.1 |
停止 MySQL 服务
[root@coderknock ~]# service mysqld stopStopping mysqld: [ OK ] |
备份数据【数据不重要可以忽略】
备份数据库,升级MySQL通常不会丢失数据,但保险起见,我们需要做这一步。输入命令:
[root@coderknock ~]# mysqldump -u xxx -h xxx -P 3306 -p --all-databases > databases.sql
卸载旧版本 MySQL
[root@coderknock ~]# yum remove mysql mysql-*Loaded plugins: securitySetting up Remove ProcessResolving Dependencies--> Running transaction check---> Package mysql.i686 0:5.1.73-7.el6 will be erased---> Package mysql-libs.i686 0:5.1.73-7.el6 will be erased--> Processing Dependency: libmysqlclient.so.16 for package: 2:postfix-2.6.6-6.el6_7.1.i686--> Processing Dependency: libmysqlclient.so.16 for package: perl-DBD-MySQL-4.013-3.el6.i686--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16) for package: 2:postfix-2.6.6-6.el6_7.1.i686--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16) for package: perl-DBD-MySQL-4.013-3.el6.i686--> Processing Dependency: mysql-libs for package: 2:postfix-2.6.6-6.el6_7.1.i686---> Package mysql-server.i686 0:5.1.73-7.el6 will be erased--> Running transaction check---> Package perl-DBD-MySQL.i686 0:4.013-3.el6 will be erased---> Package postfix.i686 2:2.6.6-6.el6_7.1 will be erased--> Processing Dependency: /usr/sbin/sendmail for package: cronie-1.4.4-16.el6_8.2.i686--> Processing Dependency: /usr/sbin/sendmail for package: redhat-lsb-core-4.0-7.el6.centos.i686--> Running transaction check---> Package cronie.i686 0:1.4.4-16.el6_8.2 will be erased--> Processing Dependency: cronie = 1.4.4-16.el6_8.2 for package: cronie-anacron-1.4.4-16.el6_8.2.i686---> Package redhat-lsb-core.i686 0:4.0-7.el6.centos will be erased--> Running transaction check---> Package cronie-anacron.i686 0:1.4.4-16.el6_8.2 will be erased--> Processing Dependency: /etc/cron.d for package: crontabs-1.10-33.el6.noarch--> Processing Dependency: /etc/cron.d for package: sysstat-9.0.4-31.el6.i686--> Restarting Dependency Resolution with new changes.--> Running transaction check---> Package crontabs.noarch 0:1.10-33.el6 will be erased---> Package sysstat.i686 0:9.0.4-31.el6 will be erased--> Finished Dependency ResolutionDependencies Resolved======================================================================================================================================================================================================= Package Arch Version Repository Size=======================================================================================================================================================================================================Removing: mysql i686 5.1.73-7.el6 @base 2.3 M mysql-libs i686 5.1.73-7.el6 @base 3.9 M mysql-server i686 5.1.73-7.el6 @base 24 MRemoving for dependencies: cronie i686 1.4.4-16.el6_8.2 @updates 169 k cronie-anacron i686 1.4.4-16.el6_8.2 @updates 38 k crontabs noarch 1.10-33.el6 @anaconda-CentOS-201311291201.i386/6.5 2.4 k perl-DBD-MySQL i686 4.013-3.el6 @base 341 k postfix i686 2:2.6.6-6.el6_7.1 @base 9.3 M redhat-lsb-core i686 4.0-7.el6.centos @anaconda-CentOS-201311291201.i386/6.5 22 k sysstat i686 9.0.4-31.el6 @base 804 kTransaction Summary=======================================================================================================================================================================================================Remove 10 Package(s)Installed size: 41 MIs this ok [y/N]: yDownloading Packages:Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction Erasing : mysql-server-5.1.73-7.el6.i686 1/10 warning: /var/log/mysqld.log saved as /var/log/mysqld.log.rpmsave Erasing : redhat-lsb-core-4.0-7.el6.centos.i686 2/10 /var/tmp/rpm-tmp.Y5QGjy: line 1: lsb_release: command not found Erasing : mysql-5.1.73-7.el6.i686 3/10 Erasing : perl-DBD-MySQL-4.013-3.el6.i686 4/10 Erasing : sysstat-9.0.4-31.el6.i686 5/10 Erasing : crontabs-1.10-33.el6.noarch 6/10 Erasing : cronie-anacron-1.4.4-16.el6_8.2.i686 7/10 Erasing : cronie-1.4.4-16.el6_8.2.i686 8/10 Erasing : 2:postfix-2.6.6-6.el6_7.1.i686 9/10 Erasing : mysql-libs-5.1.73-7.el6.i686 10/10 Verifying : redhat-lsb-core-4.0-7.el6.centos.i686 1/10 Verifying : perl-DBD-MySQL-4.013-3.el6.i686 2/10 Verifying : mysql-server-5.1.73-7.el6.i686 3/10 Verifying : crontabs-1.10-33.el6.noarch 4/10 Verifying : sysstat-9.0.4-31.el6.i686 5/10 Verifying : cronie-anacron-1.4.4-16.el6_8.2.i686 6/10 Verifying : cronie-1.4.4-16.el6_8.2.i686 7/10 Verifying : mysql-libs-5.1.73-7.el6.i686 8/10 Verifying : mysql-5.1.73-7.el6.i686 9/10 Verifying : 2:postfix-2.6.6-6.el6_7.1.i686 10/10 Removed: mysql.i686 0:5.1.73-7.el6 mysql-libs.i686 0:5.1.73-7.el6 mysql-server.i686 0:5.1.73-7.el6 Dependency Removed: cronie.i686 0:1.4.4-16.el6_8.2 cronie-anacron.i686 0:1.4.4-16.el6_8.2 crontabs.noarch 0:1.10-33.el6 perl-DBD-MySQL.i686 0:4.013-3.el6 postfix.i686 2:2.6.6-6.el6_7.1 redhat-lsb-core.i686 0:4.0-7.el6.centos sysstat.i686 0:9.0.4-31.el6 Complete! |