解決centos7.0安裝mysql後出現access defind for user@'localhost'的錯誤

在使用yum 安裝完mariadb, mariadb-server, mariadb-devel後

1. rpm -qa | grep maria   查看maria相關庫的是否在進程中

2. netstat -tulp 查看網絡服務軟件的進程列表,mysql是否在(yum install net-tools 安裝netatat等網絡分析工具)

3. mysql_secure_installation    設置安全mysql,設置mysql系統的root權限密碼,默認爲空

4. 以上當設置密碼時出現"access defind for user@'localhost'"類似的錯誤,則可使用一下方法。

    (1). mysql -uroot -p  回車空密碼登錄進mysql系統

    (2). set password for 'root'@'localhost' = password('你的密碼'); 當前就設置密碼回車

    (3). 然後再mysql -uroot -p使用剛纔的密碼登錄進去,show databases; 查看系統系統的數據庫列表

5. grant all privileges on *.* to 'root'@'%' identfied by '你的數據庫系統密碼';   設置mysql的遠程連接

    grant all privileges on 庫名.表名 to '用戶名'@'IP地址' identified by '密碼' with grant option;

公衆號

 

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