DB 추가
CREATE DATABASE database_name default CHARACTER SET UTF8mb4;
flush privileges;
DB권한을 가지는 사용자 추가
# GRANT ALL PRIVILEGES ON database_name.* TO user_name@hostname IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON database_name.* TO username@localhost IDENTIFIED BY 'password';
# INSERT INTO mysql.user (host, user, password) VALUES ('hostname', 'username', password('password'));
# insert into 를 사용하기 위해서는 null을 허용하지 않는 필드를 모두 구성해야 합니다.
flush privileges;
# 권한제거
# revoke all on database_name.table_name from user_name;
revoke all on databasename.tablename from username;
호스트 추가
GRANT ALL PRIVILEGES ON database_name.* TO 'root'@'xxx.xxx.xxx.%';
flush privileges;
비밀번호 변경
mysql> SET PASSWORD FOR 'user'@'localhost' = PASSWORD('password')
[20xx-xx-xx 18:15:42] [HY000][1287] 'SET PASSWORD FOR <user> = PASSWORD('<plaintext_password>')' is deprecated and will be removed in a future release. Please use SET PASSWORD FOR <user> = '<plaintext_password>' instead
[20xx-xx-xx 18:15:42] completed in 40 ms
mysql> flush privileges;
mysql> set password for 'user'@'localhost' = 'password'
[2019-xx-xx 18:16:13] completed in 24 ms
mysql> flush privileges;
# mysql8, root
ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'password';
flush privileges;
반응형
'db > mysql' 카테고리의 다른 글
mysql8 password() (0) | 2022.04.01 |
---|---|
MariaDB 10.0.3 Install For Ubuntu 18.04 (0) | 2018.07.20 |
MySQL, MariaDB 10.2.x Upgrade After /home Restart Error (0) | 2018.07.14 |
Access denied; SUPER privilege(s) for this operation (0) | 2018.04.23 |
slow-query select in table (0) | 2018.04.21 |