centos 7.6 安装 mysql 5.7.37-1
1 . 下载rpm
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
2 . 安装rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
3 . 修改公钥(不然安装报错)
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
不修改的报错信息
Failing package is: mysql-community-server-5.7.37-1.el7.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
4 . 安装mysql
yum install mysql-server
5 . 启动mysql
systemctl start mysqld
6 . 查找初始密码
grep "password" /var/log/mysqld.log
7 . 登录mysql
mysql -u root -p
8 . 修改初始密码
ALTER USER USER() IDENTIFIED BY 'yourpassword';
9 . 添加远程登录账号
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
退出登录
exit
10 . 添加开机自启动
systemctl enable mysqld