小伙伴关心的问题:mysql8.0.20使用教程(如何启动mysql8.0),本文通过数据整理汇集了mysql8.0.20使用教程(如何启动mysql8.0)相关信息,下面一起看看。

mysql8.0.20使用教程(如何启动mysql8.0)

前言

https://dev.mysql.com/doc/refman/8.0/en/upgrade-binary-package.html示例以 8.0.24 升级到 8.0.28 为例CentOS 7.8二进制方式升级注意:8.0.16 前的版本升级是有区别的

升级步骤

仅演示了 inplace 模式也可使用逻辑模式进行升级(导入导出)

1.升级前检查

https://dev.mysql.com/doc/refman/8.0/en/upgrade-prerequisites.html
[root@VM_0_9_centos ~]# mysqlsh -- util checkForServerUpgrade yq01@127.0.0.1:3306 --target-version=8.0.28 --config-path=/etc/my.cnf Please provide the password for yq01@127.0.0.1:3306: ****** The MySQL server at 127.0.0.1:3306, version 8.0.24 - MySQL Community Server - GPL, will now be checkedfor compatibility issues forupgrade to MySQL 8.0.28... 1) Issues reported by check table x for upgrade commandNo issues found Errors:0 ## 没有错误 Warnings: 0 ## 没有告警 Notices: 0 ## 无其他信息No known compatibility errors or issues were found.# 未发现已知兼容性错误

2.轮换密钥环主密钥[仅使用了加密表空间需要执行]

如果您要从 MySQL 5.7.11 或更早版本升级到 MySQL 8.0,并且存在加密 InnoDB表空间,请通过执行以下语句来轮换密钥环主密钥

# 查看是否配置加密 [root@mysql.sock][(none)]> show variables like %default_table_encryption%; +--------------------------+-------+ | Variable_name | Value | +--------------------------+-------+ | default_table_encryption | OFF | +--------------------------+-------+ 1 row in set (0.00 sec) # 上面查询结果为ON的时候需要执行以下语句 ALTER INSTANCE ROTATE INNODB MASTER KEY;

3.检查XA事务

# XA检查是否有值 mysql> XA RECOVER; Empty set (0.00 sec) # 若有值,则需要 COMMIT 或 ROLLBACK xid # mysql> XA COMMIT xid; # 或 # mysql> XA ROLLBACK xid;

4.innodb_fast_shutdown设置

将参数设置为0,通过慢速关机,在关机InnoDB前执行完全清除和更改缓冲区合并,以确保在版本之间文件格式存在差异的情况下数据文件已做好充分准备。

8.0 已支持 innodb_fast_shutdown = 1 或 0;

mysql -h localhost -u root -p -P3306 --execute="SET GLOBAL innodb_fast_shutdown=0"

5.关闭MySQL服务器

# 关闭MySQl service mysqld stop 或 mysqladmin -h 127.0.0.1 -u root -p shutdown

6.升级前备份

备份前注意看下容量是否足够
# 备份下数据文件,防止有问题需回滚,备份前注意看下容量是否足够,拷贝时长看数据大小 cp -rp /data/mysql3306 /data/mysql3306_bak

7.升级 MySQL 二进制安装或软件包

# cd 到安装文件目录下 tar -xvf mysql-8.0.28-linux-glibc2.12-x86_64.tar.xz -C /usr/local # 删除原来的软链 cd /usr/local unlink mysql # 重建软链 ln -s mysql-8.0.28-linux-glibc2.12-x86_64 mysql # 新的软链,链接到了新版本 lrwxrwxrwx 1 root root 35 Apr 22 17:08 mysql -> mysql-8.0.28-linux-glibc2.12-x86_64

8.启动MySQL

启动方式那么多,随意了,只要使用最新版本的
# 修改为最新的 mysqld rm -f /etc/init.d/mysqld cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld service mysqld start 或 mysqld_safe --defaults-file=/etc/my.cnf --user=mysql 2>&1

9.执行inplace升级(7 以下步骤仅升级为8.0.16前版本需要执行)

需要 root 最大权限
# 检查下是否当前客户端符合当前的版本,需要与当前升级到的版本相同 [root@VM_0_9_centos bin]# mysql --version mysql Ver 14.14 Distrib 5.7.37, for linux-glibc2.12 (x86_64) using EditLine wrapper [root@VM_0_9_centos bin]# mysql_upgrade --version mysql_upgrade Ver 2.0 Distrib 5.7.37, for linux-glibc2.12 (x86_64) [root@VM_0_9_centos bin]# mysql_upgrade -uroot -p Enter password: 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. employees.departments OK employees.dept_emp OK employees.dept_manager OK employees.employees OK employees.salaries OK employees.titles OK sys.sys_config OK Upgrade process completed successfully. Checking if update is needed.

10.加载新的帮助表

mysql -uroot -p mysql < /usr/local/mysql/share/fill_help_tables.sql

11.升级完成后再次重启

service mysqld restart

更多mysql8.0.20使用教程(如何启动mysql8.0)相关信息请关注本站,本文仅仅做为展示!