주 메뉴 열기

wwiki β

Mysql

Jhkim (토론 | 기여)님의 2018년 11월 15일 (목) 00:42 판

목차

서비스 상태 확인

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]';

변경된 권한 부여

> 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