해당 글은 Mysql v8.0.30
을 기준으로 작성 되었습니다.
## Mac
mysql.server start
mysql.server stop
mysql.server restart
## Linux
service mysql start
systemctl start mysql.server
service mysql restart
systemctl restart mysql.server
#### 버전확인 ####
mysql -v # 클라이언트
SELECT VERSION(); # MYSQL
SHOW VARIABLES LIKE %VERSION%;
USE mysql;
SHOW TABLES;
SELECT user, host FROM user;
## host
- `%`: 외부 접속 가능
- `localhost`: 해당 컴퓨터만 가능
## 기본 명령어
CREATE USER 'username'@'host' IDENTIFIED BY 'password';
CREATE USER 'username'@'host' IDENTIFIED WITH mysql_native_password BY 'password';
## 패스워드 옵션
CREATE USER 'username'@'host' IDENTIFIED WITH BY 'password' PASSWORD [EXPIRE/HISTORY/REQUIRE/REUSE] ... ;
## SSL/TLS 옵션
CREATE USER 'username'@'host' IDENTIFIED WITH caching_sha2_password BY 'sha2_password' REQUIRE [none/ssl/x509/issue/subject/cipher] ... ;
## 역할
CREATE USER 'username'@'host' DEFAULT ROLE administrator, developer
SHOW GRANTS FOR
GRANT [Privilege Option ...] ON db_name.db_table TO 'username'@'host'
-권한 삭제
REVOKE [Privilege Option ...] ON db_name.db_table FROM 'username'@'host'
이곳에서 확인 가능합니다.