【mysql】ユーザ情報表示

  • 投稿者:
  • 投稿カテゴリー:MySQL
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> select User,Host from mysql.user;
+------------------+----------------+
| User             | Host           |
+------------------+----------------+
| root             | 127.0.0.1      |
| root             | ::1            |
| debian-sys-maint | localhost      |
| phpmyadmin       | localhost      |
| root             | localhost      |
| wordpress        | localhost      |
+------------------+----------------+
6 rows in set (0.04 sec)


mysql> SHOW GRANTS FOR wordpressuser@localhost;
+------------------------------------------------------------------------------------------------------------------+
| Grants for wordpress@localhost                                                                                   |
+------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'wordpress'@'localhost' IDENTIFIED BY PASSWORD '*40passwordCCC5F8CC9DBFF'
| GRANT ALL PRIVILEGES ON `wordpressdb`.* TO 'wordpress'@'localhost' WITH GRANT OPTION                           
+------------------------------------------------------------------------------------------------------------------+
3 rows in set (0.00 sec)

ここで得たSQL文を他のDBにて実行すると、同じ情報をもったユーザを作成できる