yum clean all && yum makecache
yum -y install mysql-community-server
4. 启动:
systemctl start mysqld
systemctl enable mysqld
5. 查看密码:
grep 'temporary password' /var/log/mysqld.log
6. 修改密码:
mysql -uroot -ppassword
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
7. 登录授权:
UPDATE user SET host='%' WHERE user = 'root'; #8.0以上使用
GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'YIERSAN123pp@' WITH GRANT OPTION; #5.7
FLUSH PRIVILEGES;
8. 安装其他版本:
yum-config-manager --disable mysql80-community
yum-config-manager --enable mysql57-community
若执行命令提示:-bash: yum-config-manager: command not found
yum -y install yum-utils
通过修改/etc/yum.repos.d/mysql-community.repo文件选择版本
enabled=0 #禁用
enabled=1 #启用