[MySQL] 오류 해결 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY '{비밀번호}'

손지민·2024년 1월 4일
0

MySQL

목록 보기
3/3
post-thumbnail

개요

MySQL에 이미 있는 root 계정의 권한을 localhost 에서 %로 바꾸려는데 에러 발생

새 계정 생성 시

MySql 8.0 이후부터는
계정 생성과 권한 부여를 한 번에 할 수 없다

  • 에러 메세지
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY

  • 과거에는 아래와 같이 생성 과 권한 부여를 동시에 했다.

mysql> grant all privileges on DB이름.* to 계정ID@'%' identified by '비밀번호';
mysql> flush privileges;
  • 현재는 아래와 같이 분리하여 작업해야한다.
mysql> create user 계정ID@'%' identified by '비밀번호';
mysql> grant all privileges on DB이름.* to 계정ID@'%';
mysql> flush privileges;

이미 있는 계정의 권한 변경

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

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

참고

profile
Developer

0개의 댓글