MySQL ERROR 1044 (42000): Access denied for user

1 개요[ | ]

ERROR 1044 (42000): Access denied for user
  • 로그인은 가능하지만 권한이 없어 해당 SQL을 수행할 수 없는 오류

2 실습 예시[ | ]

  • 새 계정을 만들지만, 권한은 주지 않는다.
root@localhost:~# mysql -uroot -pMyRootP@ssw0rd
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.24 MySQL Community Server - GPL

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> CREATE USER 'jeffrey'@'%' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.02 sec)
mysql> exit
Bye
권한이 없는 경우
root@localhost:~# mysql -ujeffrey -ppassword mydb1 -e 'SHOW TABLES'      
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1044 (42000): Access denied for user 'jeffrey'@'%' to database 'mydb1'
권한이 있는 경우
root@localhost:~# mysql -uroot -pMyRootP@ssw0rd mydb1 -e 'SHOW TABLES'        
mysql: [Warning] Using a password on the command line interface can be insecure.
+--------------------------------------+
| Tables_in_mysql                      |
+--------------------------------------+
| table1                               |
| table2                               |
...
+--------------------------------------+

3 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}