sanguk.dev
작성완료
Ubuntu MariaDB 설치

Ubuntu MariaDB 설치

Ubuntu에 MariaDB를 설치하는 과정은 패키지 매니저 업데이트, MariaDB 서버 및 클라이언트 설치, 보안 설정, 서비스 시작 및 자동 재시작 설정, 사용자 생성 및 권한 설정, 외부 접속 허용, 마지막으로 모든 설정 후 재시작으로 구성됩니다.

UbuntuMariaDB

1. 패키지 매니저 업데이트 및 패키지 설치

shell
apt update
shell
apt install mariadb-server
shell
apt install mariadb-client

2. DB 보안 설정

shell
mysql_secure_installation
shell
Switch to unix_socket authentication [Y/n]
n
shell
Change the root password? [Y/n]
Y
shell
New password:
Re-enter new password:
shell
Remove anonymous users? [Y/n]
Y
shell
Disallow root login remotely? [Y/n]
n
shell
Remove test database and access to it? [Y/n]
Y
shell
Reload privilege tables now? [Y/n]
Y

3. 실행

shell
systemctl start mysql

패키지가 없을 경우 설치 필요apt install systemd


4. 실행 설정

4.1. 부팅 시 자동 재시작

shell
systemctl enable mysql

4.2. MariaDB 시작

shell
mysql -u root -p

5. 권한 및 기타 설정

5.1. MariaDB 사용자 생성 및 권한 설정

sql
CREATE USER 'root'@'%' IDENTIFIED BY '비밀번호';
sql
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
sql
FLUSH PRIVILEGES;

5.2. 외부 접속 허용

shell
vi /etc/mysql/mariadb.conf.d/50-server.cnf
shell
bind-address = 0.0.0.0

6. 모든 설정 완료 후 재시작

shell
systemctl start mysql