舜元建设 集团 有限公司网站,wordpress 总访问统计,个人网站设计模板,软件设计工作室网站文章目录 升级方式一、二进制方式安装1、下载mysql-5.7.42安装包#xff08;mysql-5.7.37升级mysql-5.7.42#xff09;2、备份数据库、my.cnf文件#xff0c;停止mysql服务#xff08;重要#xff09;3、查看当前数据库版本3、上传 mysql-5.7.42-1.el7.x86_64.rpm-bundle.… 文章目录 升级方式一、二进制方式安装1、下载mysql-5.7.42安装包mysql-5.7.37升级mysql-5.7.422、备份数据库、my.cnf文件停止mysql服务重要3、查看当前数据库版本3、上传 mysql-5.7.42-1.el7.x86_64.rpm-bundle.tar并解压4、查看安装MySQL有关的包5、升级、按顺序执行6、检查和升级数据库字典7、启动mysql检查版本和数据 升级方式二、压缩包方式安装1、下载mysql-5.7.42安装包mysql-5.7.18升级mysql-5.7.422、备份数据库重要3、备份完成之后停止mysql服务4、解压mysql-5.7.425、备份旧版mysql-5.7.18 安装目录下的文件6、删除旧版安装目录下(bin、docs、includ、lib、share、support-files、LICENSE、README)删除/etc/init.d/ 下的mysqld7、将新解压的mysql-5.7.42目录复制到原来mysql安装目录下/usr/local/mysql/并修改文件权限。8、将新解压的mysql-5.7.42的mysqld版本复制到/etc/init.d/ 下9、修改参数10、启动mysql、检查版本11、行mysql_upgrade进行检查12、账号密码、数据等检查 升级方式一、二进制方式安装
1、下载mysql-5.7.42安装包mysql-5.7.37升级mysql-5.7.42
地址https://downloads.mysql.com/archives/community/
mysql-5.7.42-1.el7.x86_64.rpm-bundle.tar
2、备份数据库、my.cnf文件停止mysql服务重要 [rootdb-mysql mysql-tar]# mysqldump -hlocalhost -uroot -p --all-databases /home/user/db-test_back_2023.sql[rootdb-mysql mysql-tar]# cp /etc/my.cnf /etc/5.7.37_my.cnf[rootdb-mysql ~]# systemctl stop mysqld 3、查看当前数据库版本
mysql selectversion;
-----------
| version |
-----------
| 5.7.37 |
-----------
1 row in set (0.00 sec)mysql
3、上传 mysql-5.7.42-1.el7.x86_64.rpm-bundle.tar并解压
[rootdb-mysql ~]# mkdir mysql-bundle
[rootdb-mysql ~]#
[rootdb-mysql ~]# tar -xvf mysql-5.7.42-1.el7.x86_64.rpm-bundle.tar -C ~/mysql-bundle
mysql-community-client-5.7.42-1.el7.x86_64.rpm
mysql-community-common-5.7.42-1.el7.x86_64.rpm
mysql-community-devel-5.7.42-1.el7.x86_64.rpm
mysql-community-embedded-5.7.42-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.42-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.42-1.el7.x86_64.rpm
mysql-community-libs-5.7.42-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.42-1.el7.x86_64.rpm
mysql-community-server-5.7.42-1.el7.x86_64.rpm
mysql-community-test-5.7.42-1.el7.x86_64.rpm
[rootdb-mysql ~]# 4、查看安装MySQL有关的包
[rootdb-mysql mysql-bundle]# rpm -qa|grep -i mysql
mysql-community-common-5.7.37-1.el7.x86_64
mysql-community-client-5.7.37-1.el7.x86_64
mysql-community-server-5.7.37-1.el7.x86_64
mysql-community-libs-5.7.37-1.el7.x86_64
[rootdb-mysql mysql-bundle]# 5、升级、按顺序执行
[rootdb-mysql mysql-bundle]# ll
总用量 544432
-rw-r--r--. 1 7155 31415 29405072 3月 18 11:09 mysql-community-client-5.7.42-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 318948 3月 18 11:09 mysql-community-common-5.7.42-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 4430172 3月 18 11:09 mysql-community-devel-5.7.42-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 48202108 3月 18 11:10 mysql-community-embedded-5.7.42-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 23316088 3月 18 11:10 mysql-community-embedded-compat-5.7.42-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 133343532 3月 18 11:10 mysql-community-embedded-devel-5.7.42-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 2747748 3月 18 11:10 mysql-community-libs-5.7.42-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 1264424 3月 18 11:10 mysql-community-libs-compat-5.7.42-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 187276248 3月 18 11:10 mysql-community-server-5.7.42-1.el7.x86_64.rpm
-rw-r--r--. 1 7155 31415 127179748 3月 18 11:10 mysql-community-test-5.7.42-1.el7.x86_64.rpm
[rootdb-mysql mysql-bundle]# rpm -Uvh mysql-community-server-5.7.42-1.el7.x86_64.rpm --force --nodeps
警告mysql-community-server-5.7.42-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
准备中... ################################# [100%]
正在升级/安装...1:mysql-community-server-5.7.42-1.e################################# [ 50%]
正在清理/删除...2:mysql-community-server-5.7.37-1.e################################# [100%]
[rootdb-mysql mysql-bundle]# rpm -Uvh mysql-community-client-5.7.42-1.el7.x86_64.rpm --force --nodeps
警告mysql-community-client-5.7.42-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
准备中... ################################# [100%]
正在升级/安装...1:mysql-community-client-5.7.42-1.e################################# [ 50%]
正在清理/删除...2:mysql-community-client-5.7.37-1.e################################# [100%]
[rootdb-mysql mysql-bundle]# rpm -Uvh mysql-community-libs-5.7.42-1.el7.x86_64.rpm --force --nodeps
警告mysql-community-libs-5.7.42-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
准备中... ################################# [100%]
正在升级/安装...1:mysql-community-libs-5.7.42-1.el7################################# [ 50%]
正在清理/删除...2:mysql-community-libs-5.7.37-1.el7################################# [100%]
[rootdb-mysql mysql-bundle]# rpm -Uvh mysql-community-common-5.7.42-1.el7.x86_64.rpm --force --nodeps
警告mysql-community-common-5.7.42-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
准备中... ################################# [100%]
正在升级/安装...1:mysql-community-common-5.7.42-1.e################################# [ 50%]
正在清理/删除...2:mysql-community-common-5.7.37-1.e################################# [100%]
[rootdb-mysql mysql-bundle]#
6、检查和升级数据库字典
[rootdb-mysql mysql-bundle]# mysql_upgrade -uroot -p123456
mysql_upgrade: [Warning] Using a password on the command line interface can be insecure.
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
The sys schema is already up to date (version 1.5.2).
Checking databases.
db-test.user OK
sys.sys_config OK
Upgrade process completed successfully.
Checking if update is needed.
[rootdb-mysql mysql-bundle]# 7、启动mysql检查版本和数据
[rootdb-mysql ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.42 MySQL Community Server (GPL)Copyright (c) 2000, 2023, Oracle and/or its affiliates.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 selectversion;
-----------
| version |
-----------
| 5.7.42 |
-----------
1 row in set (0.00 sec)mysql
mysql use db-test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql select * from user;
-----------------------------
| id | name | age | class |
-----------------------------
| 1 | 宋江 | 18 | 一班 |
| 2 | 卢俊义 | 20 | 二班 |
| 3 | 吴用 | 18 | 一班 |
| 4 | 公孙胜 | 19 | 二班 |
| 5 | 林冲 | 20 | 三班 |
| 6 | 呼延灼 | 16 | 四班 |
-----------------------------
6 rows in set (0.00 sec)mysql 升级方式二、压缩包方式安装
1、下载mysql-5.7.42安装包mysql-5.7.18升级mysql-5.7.42
地址https://downloads.mysql.com/archives/community/
mysql-5.7.42-linux-glibc2.12-x86_64.tar.gz
2、备份数据库重要
[rootdb-mysql mysql-tar]# mysqldump -hlocalhost -uroot -p --all-databases /home/user/myblog_back_2023.sql3、备份完成之后停止mysql服务
[rootdb-mysql mysql-tar]# systemctl stop mysqld
4、解压mysql-5.7.42
[rootdb-mysql mysql-tar]# tar -zxvf mysql-5.7.42-linux-glibc2.12-x86_64.tar.gz
5、备份旧版mysql-5.7.18 安装目录下的文件
[rootdb-mysql mysql]# mkdir mysql_bk
[rootdb-mysql mysql]# cp -R mysql/* mysql_bk
### 或者直接压缩
### tar -zcvf mysql.tar.gz mysql
[rootdb-mysql bin]# tar zcf mysql.tar.gz mysql6、删除旧版安装目录下(bin、docs、includ、lib、share、support-files、LICENSE、README)删除/etc/init.d/ 下的mysqld
[rootdb-mysql ~]# rm -rf bin
[rootdb-mysql ~]# rm -rf docs
[rootdb-mysql ~]# rm -rf include
[rootdb-mysql ~]# rm -rf lib
[rootdb-mysql ~]# rm -rf README
[rootdb-mysql ~]# rm -rf LICENSE
[rootdb-mysql ~]# rm -rf share
[rootdb-mysql ~]# rm -rf support-files[rootdb-mysql bin]# cd /etc/init.d/
[rootdb-mysql init.d]# tar zcf mysqld_5.7.18.tar.gz mysqld
[rootdb-mysql init.d]# rm -rf mysqld 7、将新解压的mysql-5.7.42目录复制到原来mysql安装目录下/usr/local/mysql/并修改文件权限。
[rootdb-mysql mysql-tar]# mv mysql-5.7.42-linux-glibc2.12-x86_64/* /usr/local/mysql
[rootdb-mysql mysql]# chown -R mysql:mysql /usr/local/mysql
8、将新解压的mysql-5.7.42的mysqld版本复制到/etc/init.d/ 下
[rootdb-mysql mysql-5.7.42-linux-glibc2.12-x86_64]# cp support-files/mysql.server /etc/init.d/mysqld9、修改参数
[rootdb-mysql ~]# vi /etc/init.d/mysqld
和原来安装的数据数据目录保持一致
datadir/usr/local/mysql/data
basedir/usr/local/mysql10、启动mysql、检查版本
[rootdb-mysql ~]# systemctl start mysqld
[rootdb-mysql ~]# systemctl status mysqld
● mysqld.service - LSB: start and stop MySQLLoaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)Active: active (running) since 三 2023-05-10 22:45:11 CST; 2min 36s agoDocs: man:systemd-sysv-generator(8)CGroup: /system.slice/mysqld.service├─3279 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir/usr/local/mysql/data --pid-file/usr/local/mysql/data/db-mysql.pid└─3494 /usr/local/mysql/bin/mysqld --basedir/usr/local/mysql --datadir/usr/local/mysql/data --plugin-dir/usr/local/mysql/lib/plugin --use...5月 10 22:45:10 db-mysql systemd[1]: Starting LSB: start and stop MySQL...
5月 10 22:45:11 db-mysql mysqld[3268]: Starting MySQL. SUCCESS!
5月 10 22:45:11 db-mysql systemd[1]: Started LSB: start and stop MySQL.
[rootdb-mysql ~]#
[rootdb-mysql ~]# mysql -V
mysql Ver 14.14 Distrib 5.7.42, for linux-glibc2.12 (x86_64) using EditLine wrapper
[rootdb-mysql ~]#
[rootdb-mysql ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.42 MySQL Community Server (GPL)Copyright (c) 2000, 2023, Oracle and/or its affiliates.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 show version();
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near version() at line 1
mysql
mysql selectversion;
-----------
| version |
-----------
| 5.7.42 |
-----------
1 row in set (0.00 sec)mysql
11、行mysql_upgrade进行检查
[rootdb-mysql ~]# mysql_upgrade -uroot -p --force --skip-version-check
Enter password:
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
The sys schema is already up to date (version 1.5.1).
Checking databases.
myblog.album OK
myblog.article OK
myblog.comment OK
myblog.likes OK
myblog.user OK
sys.sys_config OK
Upgrade process completed successfully.
Checking if update is needed.
[rootdb-mysql ~]#
12、账号密码、数据等检查
文章转载自: http://www.morning.xmpbh.cn.gov.cn.xmpbh.cn http://www.morning.jfjfk.cn.gov.cn.jfjfk.cn http://www.morning.rfgc.cn.gov.cn.rfgc.cn http://www.morning.ksbmx.cn.gov.cn.ksbmx.cn http://www.morning.3ox8hs.cn.gov.cn.3ox8hs.cn http://www.morning.pgcmz.cn.gov.cn.pgcmz.cn http://www.morning.wxwall.com.gov.cn.wxwall.com http://www.morning.mlbn.cn.gov.cn.mlbn.cn http://www.morning.kjyhh.cn.gov.cn.kjyhh.cn http://www.morning.xjnjb.cn.gov.cn.xjnjb.cn http://www.morning.lbbyx.cn.gov.cn.lbbyx.cn http://www.morning.wtbzt.cn.gov.cn.wtbzt.cn http://www.morning.jyznn.cn.gov.cn.jyznn.cn http://www.morning.kwxr.cn.gov.cn.kwxr.cn http://www.morning.jbtlf.cn.gov.cn.jbtlf.cn http://www.morning.bsbcp.cn.gov.cn.bsbcp.cn http://www.morning.monstercide.com.gov.cn.monstercide.com http://www.morning.mbmh.cn.gov.cn.mbmh.cn http://www.morning.snrhg.cn.gov.cn.snrhg.cn http://www.morning.kndst.cn.gov.cn.kndst.cn http://www.morning.tgtwy.cn.gov.cn.tgtwy.cn http://www.morning.bwgrd.cn.gov.cn.bwgrd.cn http://www.morning.gctgc.cn.gov.cn.gctgc.cn http://www.morning.zmnyj.cn.gov.cn.zmnyj.cn http://www.morning.brhxd.cn.gov.cn.brhxd.cn http://www.morning.tsmxh.cn.gov.cn.tsmxh.cn http://www.morning.plzgt.cn.gov.cn.plzgt.cn http://www.morning.flfxb.cn.gov.cn.flfxb.cn http://www.morning.hybmz.cn.gov.cn.hybmz.cn http://www.morning.ggfdq.cn.gov.cn.ggfdq.cn http://www.morning.xkmrr.cn.gov.cn.xkmrr.cn http://www.morning.rbzht.cn.gov.cn.rbzht.cn http://www.morning.mllmm.cn.gov.cn.mllmm.cn http://www.morning.ylyzk.cn.gov.cn.ylyzk.cn http://www.morning.tnkwj.cn.gov.cn.tnkwj.cn http://www.morning.fqqcn.cn.gov.cn.fqqcn.cn http://www.morning.jhqcr.cn.gov.cn.jhqcr.cn http://www.morning.rmxgk.cn.gov.cn.rmxgk.cn http://www.morning.rlqwz.cn.gov.cn.rlqwz.cn http://www.morning.nwtmy.cn.gov.cn.nwtmy.cn http://www.morning.tyrlk.cn.gov.cn.tyrlk.cn http://www.morning.nlgmr.cn.gov.cn.nlgmr.cn http://www.morning.wjrtg.cn.gov.cn.wjrtg.cn http://www.morning.yfmwg.cn.gov.cn.yfmwg.cn http://www.morning.nlwrg.cn.gov.cn.nlwrg.cn http://www.morning.dwxqf.cn.gov.cn.dwxqf.cn http://www.morning.fqmbt.cn.gov.cn.fqmbt.cn http://www.morning.lnyds.cn.gov.cn.lnyds.cn http://www.morning.smygl.cn.gov.cn.smygl.cn http://www.morning.pyswr.cn.gov.cn.pyswr.cn http://www.morning.zxdhp.cn.gov.cn.zxdhp.cn http://www.morning.wftrs.cn.gov.cn.wftrs.cn http://www.morning.cmldr.cn.gov.cn.cmldr.cn http://www.morning.xhklb.cn.gov.cn.xhklb.cn http://www.morning.wsxxq.cn.gov.cn.wsxxq.cn http://www.morning.txjrc.cn.gov.cn.txjrc.cn http://www.morning.spnky.cn.gov.cn.spnky.cn http://www.morning.rqgq.cn.gov.cn.rqgq.cn http://www.morning.dxtxk.cn.gov.cn.dxtxk.cn http://www.morning.jbmbj.cn.gov.cn.jbmbj.cn http://www.morning.gwtbn.cn.gov.cn.gwtbn.cn http://www.morning.bgnkl.cn.gov.cn.bgnkl.cn http://www.morning.qsswb.cn.gov.cn.qsswb.cn http://www.morning.homayy.com.gov.cn.homayy.com http://www.morning.lwxsy.cn.gov.cn.lwxsy.cn http://www.morning.rbgqn.cn.gov.cn.rbgqn.cn http://www.morning.dnls.cn.gov.cn.dnls.cn http://www.morning.lmjkn.cn.gov.cn.lmjkn.cn http://www.morning.wqrk.cn.gov.cn.wqrk.cn http://www.morning.hfyll.cn.gov.cn.hfyll.cn http://www.morning.dqpnd.cn.gov.cn.dqpnd.cn http://www.morning.wsnjn.cn.gov.cn.wsnjn.cn http://www.morning.gywfp.cn.gov.cn.gywfp.cn http://www.morning.zsyqg.cn.gov.cn.zsyqg.cn http://www.morning.twhgn.cn.gov.cn.twhgn.cn http://www.morning.pdynk.cn.gov.cn.pdynk.cn http://www.morning.ktmpw.cn.gov.cn.ktmpw.cn http://www.morning.kngqd.cn.gov.cn.kngqd.cn http://www.morning.rnxw.cn.gov.cn.rnxw.cn http://www.morning.mlwhd.cn.gov.cn.mlwhd.cn