openeuler22.03环境mysql5.7升级到mysql8.0.29
openeu2 删除mysql8默认数据库目录,复制mysql5.7数据库目录到mysql8默认目录下。删除mysql5.7的日志归档及auto.cnf配置文件,否则将因文件被占用无法启动。注意:这里cp时使用-a保持源文件的属性,否则需要手动修改文件属性。致此mysql5.7升级至mysql8.0.29完成。3 启动mysql8服务自动升级mysql5.7。以下升级过程使用root用户执行。1
以下升级过程使用root用户执行
1 安装 mysql8.0.29
❯ yum install mysql-server
2 删除mysql8默认数据库目录,复制mysql5.7数据库目录到mysql8默认目录下
❯ rm -rf /var/lib/mysql
❯ cp -a /var/lib/mysql57/data /var/lib/mysql
注意:这里cp时使用-a保持源文件的属性,否则需要手动修改文件属性。
❯ rm -rf mysql/auto.cnf
❯ rm -rf mysql/ib_logfile*
删除mysql5.7的日志归档及auto.cnf配置文件,否则将因文件被占用无法启动。
❯ setenforce 0
关闭selinux,否则将报./ibdata1权限被拒绝错误,错误如下:
os_file_get_status() failed on './ibdata1'. Can't determine file permissions
3 启动mysql8服务自动升级mysql5.7
❯ systemctl start mysqld
再开一个终端,查看升级过程日志
❯ tail -f /var/log/mysql/mysqld.log
2023-10-18T06:20:29.538734Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user . Shutting down mysqld (Version: 8.0.29).
2023-10-18T06:20:30.590284Z 0 [System] [MY-010910] [Server] /usr/libexec/mysqld: Shutdown complete (mysqld 8.0.29) Source distribution.
2023-10-18T06:22:24.150157Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using t
his option as it' is deprecated and will be removed in a future release.
2023-10-18T06:22:24.151800Z 0 [System] [MY-010116] [Server] /usr/libexec/mysqld (mysqld 8.0.29) starting as process 3653206
2023-10-18T06:22:24.268962Z 0 [Warning] [MY-010075] [Server] No existing UUID has been found, so we assume that this is the first time that this server has been starte
d. Generating a new UUID: b3aad854-6d7e-11ee-a61f-d05099d4fa2e.
2023-10-18T06:22:24.293287Z 1 [System] [MY-011012] [Server] Starting upgrade of data directory.
(开始升级数据文件目录)
2023-10-18T06:22:24.293337Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-10-18T06:22:28.166543Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-10-18T06:24:32.504481Z 2 [System] [MY-011003] [Server] Finished populating Data Dictionary tables with data.
2023-10-18T06:24:50.541998Z 5 [System] [MY-013381] [Server] Server upgrade from '50700' to '80029' started.
(升级服务)
2023-10-18T06:26:24.674418Z 5 [System] [MY-013381] [Server] Server upgrade from '50700' to '80029' completed.
2023-10-18T06:26:25.612995Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2023-10-18T06:26:25.613033Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2023-10-18T06:26:25.768956Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/lib/mysql/mysqlx.sock
2023-10-18T06:26:25.769015Z 0 [System] [MY-010931] [Server] /usr/libexec/mysqld: ready for connections. Version: '8.0.29' socket: '/var/lib/mysql/mysql.sock' port: 3
306 Source distribution.
4 查看升级后的数据库
❯ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.29 Source distribution
Copyright (c) 2000, 2022, 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 databases;
+--------------------+
| Database |
+--------------------+
| awshlp63 |
| datian_water |
| ecology |
| information_schema |
| kk-reservoir |
| mysql |
| performance_schema |
| renren_security |
| sys |
| xmhospital |
+--------------------+
10 rows in set (0.00 sec)
mysql>
致此mysql5.7升级至mysql8.0.29完成。
鲲鹏昇腾开发者社区是面向全社会开放的“联接全球计算开发者,聚合华为+生态”的社区,内容涵盖鲲鹏、昇腾资源,帮助开发者快速获取所需的知识、经验、软件、工具、算力,支撑开发者易学、好用、成功,成为核心开发者。
更多推荐

所有评论(0)