mysql 사용자 추가/권한

DB/MySql 2020. 7. 20. 22:35
반응형

Last login: Mon Jul 20 22:26:20 on ttys000

smilejsuui-MacBook-Pro:~ smilejsu$ cd /usr/local/mysql/bin

smilejsuui-MacBook-Pro:bin smilejsu$ ./mysql -u root -p

Enter password: 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 8

Server version: 8.0.21 MySQL Community Server - GPL

 

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

 

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> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| sys                |

+--------------------+

4 rows in set (0.01 sec)

 

mysql> create user smilejsu@localhost identified by '12345678';

Query OK, 0 rows affected (0.00 sec)

 

mysql> exit

Bye

smilejsuui-MacBook-Pro:bin smilejsu$ ./mysql -u smilejsu -p

Enter password: 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 9

Server version: 8.0.21 MySQL Community Server - GPL

 

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

 

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> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

+--------------------+

1 row in set (0.00 sec)

 

mysql> 

 

 

Last login: Mon Jul 20 22:32:05 on ttys000

smilejsuui-MacBook-Pro:~ smilejsu$ cd /usr/local/mysql/bin

smilejsuui-MacBook-Pro:bin smilejsu$ ./mysql -u root -p

Enter password: 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 14

Server version: 8.0.21 MySQL Community Server - GPL

 

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

 

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> grant all privileges on root.* to 'smilejsu'@'%';

ERROR 1410 (42000): You are not allowed to create a user with GRANT

mysql> CREATE USER 'root'@'%' IDENTIFIED BY 'pass';

Query OK, 0 rows affected (0.00 sec)

 

mysql> 

mysql> GRANT ALL PRIVILEGES ON smilejsu.* TO 'smilejsu'@'%' WITH GRANT OPTION;

ERROR 1410 (42000): You are not allowed to create a user with GRANT

mysql> create database nodejs;

Query OK, 1 row affected (0.00 sec)

 

mysql> show database;

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 'database' at line 1

mysql> show database;

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 'database' at line 1

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| nodejs             |

| performance_schema |

| sys                |

+--------------------+

5 rows in set (0.00 sec)

 

mysql> select nodejs;

ERROR 1054 (42S22): Unknown column 'nodejs' in 'field list'

mysql> use nodejs;

Database changed

mysql> grant all privileges on nodejs.* to 'smilejsu@localhost' with grant option;

ERROR 1410 (42000): You are not allowed to create a user with GRANT

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;

Query OK, 0 rows affected (0.01 sec)

 

mysql> grant all privileges on nodejs.* to 'smilejsu@localhost' with grant option;

ERROR 1410 (42000): You are not allowed to create a user with GRANT

mysql> GRANT ALL PRIVILEGES ON nodejs.* TO 'smilejsu'@'%' WITH GRANT OPTION;

ERROR 1410 (42000): You are not allowed to create a user with GRANT

mysql> 

mysql> CREATE USER 'root'@'%' IDENTIFIED BY 'root';

ERROR 1396 (HY000): Operation CREATE USER failed for 'root'@'%'

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;

Query OK, 0 rows affected (0.00 sec)

 

mysql> GRANT ALL PRIVILEGES ON nodejs.* TO 'smilejsu'@'%' WITH GRANT OPTION;

ERROR 1410 (42000): You are not allowed to create a user with GRANT

mysql> 

mysql> FLUSH PRIVILEGES;

Query OK, 0 rows affected (0.00 sec)

 

mysql> GRANT ALL PRIVILEGES ON nodejs.* TO 'smilejsu'@'%' WITH GRANT OPTION;

ERROR 1410 (42000): You are not allowed to create a user with GRANT

mysql> 

mysql> GRANT ALL PRIVILEGES ON nodejs.* TO 'smilejsu'@'%' WITH GRANT OPTION;

ERROR 1410 (42000): You are not allowed to create a user with GRANT

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;

Query OK, 0 rows affected (0.01 sec)

 

mysql> GRANT ALL PRIVILEGES ON nodejs.* TO'smilejsu'@'localhost';

Query OK, 0 rows affected (0.00 sec)

 

mysql> 

 

https://stackoverflow.com/questions/50177216/how-to-grant-all-privileges-to-root-user-in-mysql-8-0

 

How to grant all privileges to root user in MySQL 8.0

Tried mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION; Getting ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that

stackoverflow.com

 

반응형

'DB > MySql' 카테고리의 다른 글

[mysql] INDEX 생성  (0) 2019.07.29
: