mysql5.6简单升级到mysql5.7.28过程

原来使用root用户安装mysql5.6,升级也使用root用户执行rpm -Uvh,这是最简单的方式。mysql5.7安装、升级需要按顺序执行:

rpm -Uvh mysql-community-common-5.7.28-1.el6.x86_64.rpm
rpm -Uvh mysql-community-libs-5.7.28-1.el6.x86_64.rpm
rpm -Uvh mysql-community-client-5.7.28-1.el6.x86_64.rpm
rpm -Uvh mysql-community-server-5.7.28-1.el6.x86_64.rpm
升级安装mysql-community-common报软件冲突,由需要加上参数:
rpm -Uvh mysql-community-common-5.7.28-1.el6.x86_64.rpm --replacefiles

 

 

[root@localhost soft_rpm]# rpm -qa|grep -i mysql
MySQL-client-5.6.19-1.el6.x86_64
MySQL-server-5.6.19-1.el6.x86_64
[root@localhost soft_rpm]# mysql -uroot -proot
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.19 MySQL Community Server (GPL)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.6.19    |
+-----------+
1 row in set (0.02 sec)

[root@localhost soft_rpm]# service mysql stop
Shutting down MySQL.... SUCCESS!

[root@localhost mysql5.7.28]# rpm -Uvh mysql-community-common-5.7.28-1.el6.x86_64.rpm
warning: mysql-community-common-5.7.28-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
        file /usr/share/mysql/bulgarian/errmsg.sys from install of mysql-community-common-5.7.28-1.el6.x86_64 conflicts with file from package MySQL-server-5.6.19-1.el6.x86_64

。。。。。。。。。。。。。。。


[root@localhost mysql5.7.28]# rpm -Uvh mysql-community-common-5.7.28-1.el6.x86_64.rpm --replacefiles
warning: mysql-community-common-5.7.28-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-common ########################################### [100%]
[root@localhost mysql5.7.28]# rpm -Uvh mysql-community-libs-5.7.28-1.el6.x86_64.rpm
warning: mysql-community-libs-5.7.28-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-libs   ########################################### [100%]
[root@localhost mysql5.7.28]# rpm -Uvh mysql-community-client-5.7.28-1.el6.x86_64.rpm
warning: mysql-community-client-5.7.28-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-client ########################################### [100%]
[root@localhost mysql5.7.28]# rpm -Uvh mysql-community-server-5.7.28-1.el6.x86_64.rpm
warning: mysql-community-server-5.7.28-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-server ########################################### [100%]
[root@localhost mysql5.7.28]# rpm -qa|grep -i mysql
mysql-community-libs-5.7.28-1.el6.x86_64
mysql-community-server-5.7.28-1.el6.x86_64
mysql-community-common-5.7.28-1.el6.x86_64
mysql-community-client-5.7.28-1.el6.x86_64
[root@localhost mysql5.7.28]# mysql -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@localhost mysql5.7.28]# touch /var/lib/mysql/mysql.sock
[root@localhost mysql5.7.28]# chown mysql:mysql /var/lib/mysql/mysql.sock
[root@localhost mysql5.7.28]# service mysqld start
Starting mysqld:                                           [  OK  ]
[root@localhost mysql5.7.28]# mysql_upgrade -uroot -proot -s   #-s 表示只更新系统表
mysql_upgrade: [Warning] Using a password on the command line interface can be insecure.
The --upgrade-system-tables option was used, databases won't be touched.
Checking if update is needed.
Checking server version.
Running queries to upgrade MySQL server.
Upgrading the sys schema.
Upgrade process completed successfully.
Checking if update is needed.
[root@localhost mysql5.7.28]# service mysqld restart
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
[root@localhost mysql5.7.28]# mysql -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.28 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.7.28    |
+-----------+
1 row in set (0.01 sec)   

 

附:

非root用户安装参考之前的文章:
https://blog.csdn.net/ohaozy/article/details/103435471
https://blog.csdn.net/ohaozy/article/details/103436139
软件包使用rpm2cpio命令按以上顺序解压操作即可,与mysql5.6不同的是:
5.6初始化数据库执行:mysql_install_db --user=mysql --basedir=/data/mysql/usr --defaults-file=/data/mysql/etc/my.cnf
5.7初始化数据库执行:mysqld --initialize --basedir=/data/mysql/usr --datadir=/data/mysql/data --user=dongzw --log-error=/data/mysql/mysqld.log --pid-file=/data/mysql/mysqld.pid

--user=mysql中的mysql是linux系统上的普通用户名,任意取

非root用户安装升级也很简单,如上解压出rpm包后,覆盖原来路径下的内容,启动mysql,执行mysql_upgrade -uroot -proot -s即可。

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值