데이터베이스/MySQL&MariaDB

Mariadb 최고 관리자 패스워드 지정

이영훈닷컴 2025. 1. 14. 01:12
728x90

최고관리자 패스워드 지정

sudo mysql
use mysql
set password for 'root'@'localhost' = password('패스워드');
flush privileges;
exit;

 

최고관리자 원격 1

create user root@'%' identified by '패스워드';
grant all privileges on *.* to root@'%';
GRANT ALL PRIVILEGES ON  *.* TO 'root'@'%' REQUIRE NONE WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;
flush privileges;
exit;

 

최고 관리자 원격 2

GRANT ALL PRIVILEGES ON *.* TO '아이디'@'%' IDENTIFIED BY '패스워드';
grant all privileges on *.* to 'root'@'%' identified by '패스워드'; (원격)
set password for 'root'@'localhost' = password('패스워드');
flush privileges;
exit;

 

MariaDB&MySQL 적용방법

[MariaDB] set password for 'root'@'localhost' = password('패스워드');
[MariaDB] GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '패스워드' WITH GRANT OPTION;

[MySQL] ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '패스워드';

flush privileges;

 

원격 셋팅

sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf

[mysqld]
bind-address = 0.0.0.0
key_buffer_size = 1G -> 512M -> 128M
innodb_buffer_pool_size = 512M
innodb_buffer_pool_size = 6G
init_connect="SET collation_connection=utf8_general_ci"
character-set-server = utf8
collation-server = utf8_unicode_ci
728x90