centos7.2 mysql5.7安裝教程

ramsey發表於2021-07-10

安裝 mysql 源

1.下載:

wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

2.安裝mysql源

yum localinstall mysql57-community-release-el7-11.noarch.rpm

3.安裝mysql

yum install -y mysql-community-server

4.初始化 MySQL:
/usr/sbin/mysqld –user=mysql –initialize

5.啟動mysql
/usr/sbin/mysqld –user=mysql &

6.登陸mysql
首先獲取mysql的初始密碼:grep ‘temporary password’ /var/log/mysqld.log
mysql -uroot -p

7.更改mysql密碼
mysql> set password for ‘root‘@’localhost’=password(‘root’);
然後需要重新整理許可權:
mysql> flush privileges;

8.開放遠端登陸許可權:
執行如下命令:
1.mysql> use mysql;
2.mysql> update user set host = ‘%’ where user = ‘root’;
3.mysql> flush privileges;

本作品採用《CC 協議》,轉載必須註明作者和本文連結
拉姆塞

相關文章