安装MySQL
安装环境:
开始安装:
wget https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm
yum install mysql80-community-release-el8-1.noarch.rpm
yum module disable mysql
yum module disable mysql
yum install mysql-community-server
开启服务:service mysqld start 查看服务状态:service mysqld status Active: active(running):表示开启状态 Active: inactive(dead):表示未开启状态 关闭服务:service mysqld stop
grep ‘temporary password’ /var/log/mysqld.log
mysql -u root -p 输入上面的随机密码
ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘Root_21root’;
修改密码长度:set global validate_password.length=1;(长度) 修改密码等级:set global validate_password.policy=0;(等级)
ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘123456’;
首先(或者在最后)在阿里云设置安全组需要开放3306端口 其次输入命令:firewall-cmd --permanent --zone=public --add-port=3306/tcp 如果失败,看防火墙是否打开 查看防火墙的状态:systemctl start firewalld 开启防火墙:systemctl status firewalld 关闭防火墙:systemctl stop firewalld 最后刷新:firewall-cmd --reload
use mysql; select host, user, authentication_string, plugin from user; //将root的host的值从localhost --> % update user set host=’%’ where user = ‘root’; flush privileges;
Navicat连接
END
参考链接
|