CentOS安装mysql

Published on 2021-01-13 00:21 in 分类: 软件 with 狂盗一枝梅
分类: 软件

1.安装wget

yum install wget

2.下载mysql的rpm

wget http://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm

3.安装mysql源

rpm -Uvh mysql57-community-release-el7-10.noarch.rpm

5.安装Mysql

yum install -y mysql-community-server

这时候可能出现签名问题,运行以下命令解决

rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

然后重新尝试运行命令:

yum -y install mysql-community-server

6.查看mysql版本

mysql --version

7.启动Mysql并查看Mysql状态

systemctl start mysqld.service
systemctl status mysqld.service

8.获取临时密码

grep "password"  /var/log/mysqld.log

9.远程登陆设置

使用命令

mysql -uroot -p

登陆mysql,之后使用命令

set global validate_password_policy=LOW;

降低密码复杂度要求,然后使用命令

ALTER USER USER() IDENTIFIED BY 'your password';

重置密码,之后使用命令

grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option; #123456为你需要设置的密码

设置远程访问,然后使用命令

FLUSH PRIVILEGES;

刷新权限。 退出mysql。

10.重启mysql

 service mysqld restart

安装完成

11.注意腾讯云个坑货

腾讯云需要在控制台开放端口

参考文章:

https://blog.csdn.net/qq_37130607/article/details/105854301

https://blog.csdn.net/muziljx/article/details/81541896

https://blog.csdn.net/zhanaolu4821/article/details/93622812

https://blog.csdn.net/zhaokuo719/article/details/105508321/

https://programmerah.com/solved-mysql-install-error-gpg-check-failed-54675/

https://cloud.tencent.com/developer/article/1886339

https://learnku.com/articles/35042


#centos #mysql #linux
目录