adminユーザの変更(WordPress2.9)

2010年09月02日 23時55分 WordPress • Tags:



WordPressのログインユーザ「admin」の変更方法のメモです。2.9で試しています。3.0でも同様にできるかもしれませんが、テーブルを確認してください。

WordPressのログインユーザはwp_usersテーブルのloginカラムで管理されています。loginカラムがadminになっているユーザのloginカラムの値を任意のログインユーザIDに変更します。

 update wp_users set user_login = 'myuser' where user_login = 'admin';

 
以下は一連の操作です。

[root@hrtdotnet ~]# /usr/local/mysql5/bin/mysql -u dbuser -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 18840
Server version: 5.0.90-log Source distribution

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

mysql> use dbtest;
Database changed
mysql> show tables;
+-----------------------+
| Tables_in_dbtest     |
+-----------------------+
| wp_commentmeta        |
| wp_comments           |
| wp_links              |
| wp_options            |
| wp_postmeta           |
| wp_posts              |
| wp_term_relationships |
| wp_term_taxonomy      |
| wp_terms              |
| wp_usermeta           |
| wp_users              |
+-----------------------+
11 rows in set (0.00 sec)

mysql> select * from wp_users;
+----+------------+------------------------------------+---------------+--------------------+----------+---------------------+---------------------+-------------+--------------+
| ID | user_login | user_pass                          | user_nicename | user_email         | user_url | user_registered     | user_activation_key | user_status | display_name |
+----+------------+------------------------------------+---------------+--------------------+----------+---------------------+---------------------+-------------+--------------+
|  1 | admin      | XXXXXXXXXXXXXXXXXXXXXXXXX | admin         | xxxxxxxxxx@sample.com |          | 2010-07-18 09:00:59 |                     |           0 | admin        |
+----+------------+------------------------------------+---------------+--------------------+----------+---------------------+---------------------+-------------+--------------+
1 row in set (0.00 sec)

mysql> update wp_users set user_login = 'myuser' where user_login = 'admin';
Query OK, 1 row affected (0.02 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from wp_users;
+----+------------+------------------------------------+---------------+--------------------+----------+---------------------+---------------------+-------------+--------------+
| ID | user_login | user_pass                          | user_nicename | user_email         | user_url | user_registered     | user_activation_key | user_status | display_name |
+----+------------+------------------------------------+---------------+--------------------+----------+---------------------+---------------------+-------------+--------------+
|  1 | myuser  | XXXXXXXXXXXXXXXXXXXXXXXXX | admin         | xxxxxxxxxx@sample.com |          | 2010-07-18 09:00:59 |                     |           0 | admin        |
+----+------------+------------------------------------+---------------+--------------------+----------+---------------------+---------------------+-------------+--------------+
1 row in set (0.00 sec)

 



Leave a Reply

preload preload preload