阿里云 centos8.0 安装mysql8.0

1.检查服务器有没有安装过mysql
yum list installed mysql*
rpm -qa | grep mysql*
2.下载mysql rpm
yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

3.安装
yum install -y mysql-server

4.设置开机启动Mysql
systemctl enable mysqld.service

5.检查是否已经安装了开机自动启动
systemctl list-unit-files | grep mysqld

6.设置开启服务
systemctl start mysqld.service

7.查看临时登录密码
grep 'temporary password' /var/log/mysql/mysqld.log
如果没有就不用输入密码

8.修改root密码并生效
ALTER USER 'root'@'localhost' IDENTIFIED BY 'shewHUHWE6723&^23.';

9.创建远程登录用户
CREATE USER 'sunup'@'%' IDENTIFIED BY 'shewWE6723&^23.';

10.更改用户加密规则
ALTER USER 'sunup'@'%' IDENTIFIED WITH mysql_native_password BY 'shewWE6723&^23.';

11.授权用户远程登录权限
grant all on *.* to 'sunup'@'%';

12.刷新配置
flush privileges;

你可能感兴趣的:(mysql)