티스토리 뷰

반응형

1. 연결

mysql -u [user id] -p mysql


2. db 생성

create database [database name];


3. table 및 user 생성 및 user 할당

grant all privileges on [database name].* to [user id]@localhost identified by '[password]' with grant option;


4. user 생성 확인

use mysql;

select * from user;


5. 연결

mysql -u [user id] -p [database name]



[root@build-test FlowAgent]# mysql -u root -p mysql

Enter password:

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A


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

Your MySQL connection id is 38

Server version: 5.6.34 MySQL Community Server (GPL)


Copyright (c) 2000, 2016, 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> create database test_table;

Query OK, 1 row affected (0.00 sec)


mysql> grant all privileges on test_table.* to test_user@localhost identified by 'testpassword' with grant option;

Query OK, 0 rows affected (0.00 sec)


mysql> use mysql;

Database changed

mysql> select * from user;

mysql> quit

Bye

[root@build-test FlowAgent]# mysql -u test_user -p test_table

Enter password: 

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

Your MySQL connection id is 39

Server version: 5.6.34 MySQL Community Server (GPL)


Copyright (c) 2000, 2016, 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>


반응형
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함