데이터베이스 생성

1.

1
2
create database python;
 
cs

python : 생성하려는 데이터베이스 명칭


2. 확인

 2-1. exec

1
2
show databases;
 
cs


 2-2. result


사용자 추가

3.

1
2
create user 'python'@'%' identified by '****';
 
cs
python : 추가하려는 사용자 명칭
% : 접근 허용 가능한 호스트를 지정. %는 모든 호스트에서 접근 가능함을 의미.
**** : 해당 계정의 비밀번호를 입력

4. 확인

 4-1.

1
2
use mysql;
 
cs


 4-2.

1
2
select * from user;
 
cs


 4-3.


DB 접근 권한 부여

5.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.7.22-0ubuntu0.16.04.1 (Ubuntu)
 
Copyright (c) 2000, 2018, 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>
 
cs


6.

1
2
3
mysql> grant all on python.* to python@'%' identified by '****' with grant option;
Query OK, 0 rows affected, 1 warning (0.00 sec)
 
cs

python 데이터베이스에 python 계정 및 비밀번호로 접근 할당한다는 의미입니다.

**** : 해당 계정의 비밀번호


7. 접속 확인


'Database > MySQL' 카테고리의 다른 글

MySQL Workbench 설치  (0) 2018.09.28
root 계정 외부 접근 권한 할당  (0) 2018.07.03
windows 10 mysql 설치  (0) 2018.07.03
ERROR 1396  (0) 2018.01.15
계정 생성 및 비밀번호와 권한 추가 혹은 변경  (0) 2017.11.02

+ Recent posts