Centos安裝完mysql卻不知道初始密碼無法進入,改爲自己的密碼

Centos安裝完mysql卻不知道初始密碼無法進入,改爲自己的密碼

停止服務: /etc/init.d/mysqld stop  
進入安全模式: mysqld_safe --user=mysql --skip-grant-tables --skip-networking &  
  mysql -u root mysql   
修改密碼:mysql> UPDATE user SET Password=PASSWORD('自己的密碼') where USER='root';   
mysql> FLUSH PRIVILEGES;   
mysql> quit  
啓動服務: /etc/init.d/mysql restart  
登錄: mysql -uroot -p   
   Enter password: <輸入自己的密碼>   
進入:mysql> 

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