CentOS7 下 yum 成功安裝 MySQL 5.7

第一部分:CentOS 7安裝MySQL 5.7

1.下載YUM庫

shell > wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm

2.安裝YUM庫

shell > yum localinstall -y mysql57-community-release-el7-7.noarch.rpm

3.安裝數據庫

shell > yum install -y mysql-community-server

4.啓動MySQL服務

shell > systemctl start mysqld.service

5.默認空密碼

shell > mysql -uroot -p

6.重置root密碼後重啓mysql服務

shell > update mysql.user set authentication_string=password("yourpassword") where user="root" and Host="localhost";

shell > flush privileges;

shell > quit;

shell > systemctl restart mysqld;

如果手賤或者不知道啥原因出現如下問題:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

請修改my.cnf,添加skip-grant-tables和skip-networking:

shell > vi /etc/my.cnf

[mysqld]

skip-grant-tables

skip-networking

重啓mysql,然後重複以上修改密碼步驟即可,記得修改完後,去掉my.cnf添加的兩行。


本文測試成功不到5分鐘內即可安裝使用,轉載自:https://www.linuxidc.com/Linux/2016-08/134790.htm

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章