카테고리 없음
[mysql] 비밀번호 초기 설정 시 에러 mysql> create user root@localhost identified by 비밀번호;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 u..
보리시스템
2023. 7. 14. 17:50
비밀번호 초기 설정 시에 기존에 하던대로 이렇게 입력했는데 synteax error가 발생했다.
create user root@localhost identified by 비밀번호;
그래서 create 말고 alter로 입력해봤는데도 안된다.
ALTER USER root@localhost IDENTIFIED BY 0000;
그래서 mysql 문서에서 찾아서 아래와 같이 입력하니 정상작동한다.
mysql 8.0 이후로 설정 방법이 바뀐듯하다.
SET PASSWORD FOR 'jeffrey'@'localhost' = 'auth_string';
https://dev.mysql.com/doc/refman/8.0/en/set-password.html
MySQL :: MySQL 8.0 Reference Manual :: 13.7.1.10 SET PASSWORD Statement
13.7.1.10 SET PASSWORD Statement SET PASSWORD [FOR user] auth_option [REPLACE 'current_auth_string'] [RETAIN CURRENT PASSWORD] auth_option: { = 'auth_string' | TO RANDOM } The SET PASSWORD statement assigns a password to a MySQL user account. The password
dev.mysql.com
bolee@bolees-MacBook-Pro ~ % mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.33 Homebrew
Copyright (c) 2000, 2023, 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> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select host, user from user;
+-----------+------------------+
| host | user |
+-----------+------------------+
| localhost | mysql.infoschema |
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
+-----------+------------------+
4 rows in set (0.00 sec)
mysql> create user root@localhost identified by 비밀번호;
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 '비밀번호' at line 1
mysql> ALTER USER root@localhost IDENTIFIED BY 비밀번호;
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 '비밀번호' at line 1