2015年2月28日土曜日

mysql password forggot

rootのパスワードを忘れてしまった場ってことはない?
下記のように対処すると、パスワードの変更を行うことができる。

(1)サービスの停止
以下のコマンドを実行して、デーモンを停止してください。
service mysqld  stop

(2)パスワード無しでログイン出来るようにMySQLを起動
#mysqld_safe --skip-grant-tables

(3)MySQLに接続して、パスワード変更
>mysql -u root mysql
mysql>use mysql;
mysql>update user set password=PASSWORD('new_password') where user='root' and host='localhost';
mysql>FLUSH PRIVILEGES;

(4)サービス起動
service mysqld restart

0 件のコメント:

コメントを投稿