OpenEuler 22.03 LTS-SP4 二进制部署MySQL 5.7
一、获取MySQL软件
通用二进制版本: 本文档采用此方式安装
https://dev.mysql.com/downloads/mysql/
点击“Looking for previous GA versions?”,跳转后依次选择“Linux-Generic”“Linux-Generic(glibc2.12)(x86,64-bit)”
源码包 版本:过于复杂,一般有自定义需求才采用此方式
https://dev.mysql.com/downloads/mysql/
点击“Looking for previous GA versions?”,跳转后依次选择“Source Code”“All Operating Systems(Generic)”
二、MySQL二进制安装
备注: !!!!!!!!!!!!!!!!!部署前需要先 yum remove mariadb
2.1、创建mysql工作目录:
2.2、上传软件,并解压并改名为app
[root@db01 app]# tar -xf /root/mysql-5.7.39-linux-glibc2.12-x86_64.tar.gz
2.3、修改环境变量:
2.4、建立mysql用户和组(如果有可忽略)
2.5、创建mysql 数据目录,日志目录;并修改权限
2.6、准备my.cnf 配置文件
2.7、初始化数据(建库)
2.8、使用systemd管理mysql
2.9、systemd 管理相关命令
2.10、修改root密码
2.11、使用新密码登录
三、常见问题
3.1 问题1:
mysqld --initialize-user=mysql --basedir=/app/mysqlmyseld: error while loading shared libraries: libaio.so.1: cannot open shared obiect file: No suchor directory
3.2 问题2:
mysql登录报错,mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory**
3.3 问题3:
[ERROR] --initialize specified but the data directory has files in it
- 感谢你赐予我前进的力量