ERROR 1410 (42000): You are not allowed to create a user with GRANT - 권한 부여 관련 에러

inhalin·2021년 5월 14일
1

MySQL

목록 보기
6/8

내용

mysql에서 root로 접속

PS C:\Users\user> mysql -u root -p
Enter password: <비밀번호>

사용자 user1에게 test_db에 대한 권한 부여 시도

mysql> grant all privileges on test_db.* to user1@locahost;
ERROR 1410 (42000): You are not allowed to create a user with GRANT

해결법

외부 접근 권한이 있는 root 유저 생성 후 확인

mysql> create user 'root'@'%' identified by 'asdf';
mysql> select host, user from user;
+-----------+------------------+
| host      | user             |
+-----------+------------------+
| %         | root             |
| 127.0.0.1 | root             |
| localhost | user1            |
+-----------+------------------+

원하는 사용자에게 권한 부여 후 'root'@'%' 삭제

mysql> grant all privileges on test_db.* to user1@locahost;
mysql> drop user 'root'@'%';

권한 부여 잘 됐는지 확인

mysql> show grants for user1@localhost;
+------------------------------------------------------------+
| Grants for user1@localhost                                 |
+------------------------------------------------------------+
| GRANT USAGE ON *.* TO `user1`@`localhost`                  |
| GRANT ALL PRIVILEGES ON `test_db`.* TO `user1`@`localhost` |
+------------------------------------------------------------+

0개의 댓글