下载 rpm包node
wget https://goodrain-pkg.oss-cn-shanghai.aliyuncs.com/mysql8.rpm tar xvf mysql8.rpm cd mysql/
卸载mariadbmysql
rpm -qa|grep mariadb rpm -e mariadb-libs-5.5.65-1.el7.x86_64 --nodeps
安装 MySQLgit
rpm -ivh mysql-community-server-8.0.20-1.el7.x86_64.rpm mysql-community-client-8.0.20-1.el7.x86_64.rpm mysql-community-common-8.0.20-1.el7.x86_64.rpm mysql-community-libs-8.0.20-1.el7.x86_64.rpm net-tools-2.0-0.25.20131004git.el7.x86_64.rpm
启动 MySQLsql
systemctl restart mysqld systemctl enable mysqld
获取密码bash
$ grep "A temporary password is generated for root@localhost" /var/log/mysqld.log 2020-06-07T12:51:10.889926Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 7Pq+r7v5H:d1
登陆并修改密码工具
mysql -uroot -p7Pq+r7v5H:d1 ### 初始化时已更改root密码,这里能够省略 mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Www.1.com';
建立用户并受权加密
### 为了不SQLyog链接8.0报:Error No.2058 Plugin caching_sha2_password could not be loaded,后续工具更新后,再使用8.0新的加密方式 mysql> CREATE USER 'test'@'%' IDENTIFIED WITH mysql_native_password BY 'Www.1.com'; ### 授予test用户全部权限 mysql> GRANT ALL PRIVILEGES ON *.* TO 'test'@'%' WITH GRANT OPTION;