株式会社ヴァンデミックシステム

Blog

<スポンサーリンク>

WordPress接続ユーザのパスワードを忘れちゃったときとか、登録しているメアドにも届かないときとか。

#mysqlへの接続情報を確認
[root@ASMODEUS ~]# cat /var/www/wordpress/wp-config.php  | egrep 'DB_NAME|DB_USER|DB_PASSWORD'
define('DB_NAME', 'wp');		#WordPressで使用されているDB
define('DB_USER', 'wp');		#DB接続するユーザ
define('DB_PASSWORD', 'P@ssw0rd');	#DB接続するユーザのパスワード

#mysqlへログイン  mysql [DB名] -u [ユーザ名] -p
[root@ASMODEUS ~]# mysql wp -u wp -p
Enter password:		#パスワードを入力
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 43
Server version: 5.5.52-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

#初期化するユーザの確認
MariaDB [wp]> select user_login, user_pass from wp_users;
+------------+------------------------------------+
| user_login | user_pass                          |
+------------+------------------------------------+
| admin      | $P$BHuerClPJdN2BHxIIH9t7LHaX0ICQa. |
+------------+------------------------------------+
1 row in set (0.00 sec)

#パスワードをハッシュ化してUPDATE
MariaDB [wp]> update wp_users set user_pass = md5('P@ssw0rd') where user_login = 'admin';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

#さっきと変わっていることを確認
MariaDB [wp]> select user_login, user_pass from wp_users;
+------------+----------------------------------+
| user_login | user_pass                        |
+------------+----------------------------------+
| admin      | 161ebd7d45089b3446ee4e0d86dbcf92 |
+------------+----------------------------------+
1 row in set (0.00 sec)

これで入れるようになっていると思う(^^)

<スポンサーリンク>

コメントを残す

Allowed tags:  you may use these HTML tags and attributes: <a href="">, <strong>, <em>, <h1>, <h2>, <h3>
Please note:  all comments go through moderation.

*

日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)