忍者ブログ
Live as though heaven is on earth 生きなさい 今日が最後の日であるように
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

mysqlのrootのパスワードが忘れた場合は、再設定する方法

1.まず skip-grant-tablesで mysqlを再起動する
 
# vi /etc/my.cnf
 [mysqld] セクションのところ、下記を追加

skip-name-resolve
skip-grant-tables
2.mysqldを再起動
 
# /etc/init.d/mysqld restart
Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]
3.mysqlにログインして、パスワードを再設定する
 
# /usr/bin/mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 3.23.56

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> USE mysql ;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> UPDATE user SET Password = password ( 'new-password' ) WHERE User = 'root' ;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2 Changed: 0 Warnings: 0

mysql> flush privileges ;
Query OK, 0 rows affected (0.01 sec)

mysql> quit
Bye
5.my.cnfの設定を元に戻す
 
# vi /etc/my.cnf
6.mysqldを再起動
 
# /etc/init.d/mysqld restart
Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]

拍手[0回]

PR
COMMENT FORM
NAME
URL
MAIL
PASS
TITLE
COMMENT
Vodafone絵文字 i-mode絵文字 Ezweb絵文字
COMMENT
TRACKBACK
TRACKBACK URL > 
ブログ内検索
AD
忍者カウンター

プロフィール
HN:
Lynn
年齢:
38
性別:
女性
誕生日:
1985/10/20
職業:
クリエーター
バーコード
アクセス解析
忍者ブログ [PR]
"Lynn" WROTE ALL ARTICLES.
PRODUCED BY SHINOBI.JP @ SAMURAI FACTORY INC.