0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Mysql user作成と関連操作

0
Last updated at Posted at 2026-06-28

MySQLで新規ユーザ追加と関連する確認SQL。

# mysql -u root -p

パスワードは8文字以上で大文字・小文字・数字・特殊文字をすべて含める必要があります。
mysql> CREATE USER '*****_user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'パスワード';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT SELECT, INSERT, UPDATE, DELETE ON *****_db.* TO '*****_user'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

mysql> SELECT  host, user FROM mysql.user;
+-----------+------------------+
| host      | user             |
+-----------+------------------+
| localhost | *****_user  |
| localhost | debian-sys-maint |
| localhost | mysql.infoschema |
| localhost | mysql.session    |
| localhost | mysql.sys        |
| localhost | root             |
+-----------+------------------+
6 rows in set (0.00 sec)

mysql> 

参考サイト:
https://qiita.com/gatapon/items/92b942fa7081cfe17482

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?