"Mysql"의 두 판 사이의 차이

wwiki
이동: 둘러보기, 검색
(데이터베이스 사용권한 부여)
22번째 줄: 22번째 줄:
 
> insert into user(host, user, password) values ('192.168.0.%', '[user]','password([password])');
 
> insert into user(host, user, password) values ('192.168.0.%', '[user]','password([password])');
  
===데이터베이스 사용권한 부여===
+
===데이터베이스 사용권한===
 +
 
 +
==== 권한부여 ====
 
> grant all privileges on [database].* to [user]@'192.168.0.%' identified by '[password]';
 
> grant all privileges on [database].* to [user]@'192.168.0.%' identified by '[password]';
 +
 +
==== 권한 확인 ====
 +
> show grants ;
 +
 +
==== 권한 삭제 ====
 +
> revoke all on [database].[table] from [user]@host;
 +
 +
[table]<!-- 테이블명 -->은 생략가능
  
 
===변경된 권한 부여===
 
===변경된 권한 부여===
69번째 줄: 79번째 줄:
 
)'''ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC''';
 
)'''ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC''';
  
=== GUI Tool ===
+
===GUI Tool===
 
https://www.mysql.com/products/workbench/
 
https://www.mysql.com/products/workbench/

2018년 11월 15일 (목) 00:50 판

서비스 상태 확인

systemctl status mysql

MySQL monitor

# mysql -u root

> show databases;

외부아이피 접속 설정

# nano /etc/mysql/mariadb.conf.d/50-server.cnf

bind-address            = 0.0.0.0

사용자 보기

> use mysql;

> select host, user, password from user;

사용자 추가

> insert into user(host, user, password) values ('localhost', '[user]','password([password])');

> insert into user(host, user, password) values ('192.168.0.%', '[user]','password([password])');

데이터베이스 사용권한

권한부여

> grant all privileges on [database].* to [user]@'192.168.0.%' identified by '[password]';

권한 확인

> show grants ;

권한 삭제

> revoke all on [database].[table] from [user]@host;

[table]은 생략가능

변경된 권한 부여

> flush privileges;

Barracuda format변경

에러내용

Index column size too large. The maximum column size is 767 bytes.

위 에러가 나는 경우에 변경해 주어야 한다.

현재 포맷 확인

> use mysql;

> show variables like 'innodb_file_format';

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

| Variable_name | Value |

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

| innodb_file_format | Antelope |

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

설정 수정

> set global innodb_large_prefix = ON;

> set global innodb_file_format = BARRACUDA;

Create Table 옵션추가

> CREATE TABLE [table_name] (

`Id` varchar(767) NOT NULL,

`Name` varchar(256) NULL,

`NormalizedName` varchar(256) NULL,

`ConcurrencyStamp` text NULL,

PRIMARY KEY (`Id`)

)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;

GUI Tool

https://www.mysql.com/products/workbench/