1. 物理设备
1C2G 云服务器 X 1
2. 操作系统
centOS 8.3 64位
3. MySQL 8 安装步骤
shell> yum install libaio
shell> cd /usr/local/
shell> mkdir software
shell> cd software/
shell> wget https://repo.huaweicloud.com/mysql/Downloads/MySQL-8.0/mysql-8.0.23-linux-glibc2.12-x86_64.tar.xz
shell> cd /usr/local/
shell> tar xvf /usr/local/software/mysql-8.0.23-linux-glibc2.12-x86_64.tar.xz
shell> ln -s /usr/local/mysql-8.0.23-linux-glibc2.12-x86_64 mysql
shell> cd mysql
shell> mkdir mysql-files
shell> sudo groupadd mysql
shell> sudo useradd -r -g mysql -s /bin/false mysql
shell> chown mysql:mysql mysql-files
shell> chmod 750 mysql-files
shell> bin/mysqld --initialize --user=mysql
shell> bin/mysql_ssl_rsa_setup
shell> bin/mysqld_safe --user=mysql &
shell> cp support-files/mysql.server /etc/init.d/mysql.server
shell> export PATH=$PATH:/usr/local/mysql/bin
shell> service mysql.server start
shell> mysql -u root -p
shell> ALTER USER 'root'@'localhost' IDENTIFIED BY '384$SFQy';
shell> CREATE USER IF NOT EXISTS 'canal'@'%' \
IDENTIFIED WITH mysql_native_password \
BY 'rv4wOFws';
shell> GRANT ALL ON *.* TO 'canal'@'%';
配置环境变量
shell> vi /etc/profile
shell> export PATH=$PATH:/usr/local/mysql/bin # in end write and save
shell> source /etc/profile
4. 验证
通过 navicat 登陆 MySQL
username: root
password: 384$SFQy
username: canal
password: rv4wOFws
5. 配置 MySQL
查找 MySQL 配置文件 my.cnf 的位置
shell> mysql --help|grep my.cnf
shell> cat /etc/my.cnf # mysql config file location
shell> vi /etc/my.cnf
shell> service mysql.server restart