LoginSignup
0
0

More than 1 year has passed since last update.

ERROR 1044 (42000): Access denied for user 'ユーザー名'@'%' to database 'データベース名'

Posted at

権限があるのに、データベースが作成できずはまったのでメモします。

まずは、権限の確認。
全ての権限をもっていましたが、データベースが作成できませんでした。

mysql
mysql> show grants;
+-------------------------------------------------------------+
| Grants for saaaMPro.local@%                                 |
+-------------------------------------------------------------+
| GRANT USAGE ON *.* TO `ユーザー名`@`%`                  |
| GRANT ALL PRIVILEGES ON `db1`.`*` TO `ユーザー名`@`%`  |
+-------------------------------------------------------------+

一旦、退出します。

mysql
mysql> exit;
Bye

次は、rootで入り、作成したい名前のデータベースに権限を与えます。

mysql
mysql> GRANT ALL PRIVILEGES ON データベース名.* TO 'ユーザー名'@'%';
Query OK, 0 rows affected (0.00 sec)

データベースを作成します。

mysql> CREATE DATABASE データベース名 CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
Query OK, 1 row affected (0.01 sec

最後に確認

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| performance_schema |
| データベース名        |
+--------------------+

今回は、ChatGDPに全て聞きました笑
すごい!!!!!
まずは、試してみる!
ChatGDP

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