close

CentOS-Mysql-Access denied for user root

在CentOS(64bit)平台,無法使用root用戶進行登錄;

mysql -u root -p

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

方法/步驟

停掉MySQL服務:

/etc/init.d/mysqld stop

使用safe模式,進行重啟:

 mysqld_safe --skip-grant-tables

 

使用root帳戶,無密碼登錄:

  mysql -u root

選擇mysql database:

  use mysql;

為root用戶更改密碼為: 123456(自行設定):

  update user set password=PASSWORD("123456") where User = 'root';

exit;離開 

 

停止MySQL 服務:

/etc/init.d/mysqld stop

重新啟動MySQL服務:

/etc/init.d/mysqld start

使用root帳戶正常登錄:

mysql -u root -p

這樣就成功改密碼了。

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 benson82208 的頭像
    benson82208

    MIS記錄

    benson82208 發表在 痞客邦 留言(0) 人氣()