1.下載並安裝MySQL官方的 Yum Repository 2.MySQL資料庫設置 啟動MySQL 查找MySQL的預設密碼 進入資料庫 輸入初始密碼,如下命令修改密碼 此時還有一個問題,之前安裝了Yum Repository,以後每次yum操作都會自動更新,需要把這個卸載掉 進入資料庫允許遠程 ...
1.下載並安裝MySQL官方的 Yum Repository
[root@sweetBaby ~]# wget -i -c https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
[root@sweetBaby ~]# yum -y install mysql80-community-release-el7-1.noarch.rpm
[root@sweetBaby ~]# yum -y install mysql-community-server
2.MySQL資料庫設置
啟動MySQL
[root@sweetBaby ~]# systemctl start mysqld.service
查找MySQL的預設密碼
[root@sweetBaby ~]# grep "password" /var/log/mysqld.log
進入資料庫
[root@sweetBaby ~]# mysql -u root -p
輸入初始密碼,如下命令修改密碼
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';
此時還有一個問題,之前安裝了Yum Repository,以後每次yum操作都會自動更新,需要把這個卸載掉
[root@sweetBaby ~]# yum -y remove mysql57-community-release-el7-10.noarch
進入資料庫允許遠程連接
mysql> use mysql;
mysql> update user set host = '%' where user = 'root';
mysql> flush privileges;
退出資料庫
mysql> quit;
OK,就這樣!
欲買桂花同載酒,終不似,少年游