sudo apt update
sudo apt-get install mariadb-server
sudo apt-get install mariadb-client
systemctl status mariadb

active (running) 상태가 아니라면,sudo systemctl start mariadb
sudo ufw allow 3306/tcp
sudo ufw status

sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf
로컬 호스트에서만 접속할 수 있도록 bind-address=127.0.0.1 로 설정 되어있다.

접속하고자 하는 IP 주소를 bind-address 에 추가해야 한다.
bind-address=0.0.0.0 으로 설정하면 모든 IP 주소 허용

sudo mysqladmin -u root -p password 'mypassword'
mysql -u root -p

grant all on <데이터베이스이름>.<테이블이름> to '<유저명>'@'<IP>' identified by '<비밀번호>';
grant all on *.* to 'root'@'%' identified by 'mypassword';
*.* (모든 데이터베이스의 모든 테이블)root% (모든 IP)
flush privileges;



mariadb 서비스는 3306번 포트, tcp 프로토콜을 사용
호스트 IP : 호스트 Windows 의 IP
명령 프롬프트 혹은 PowerShell 에 ipconfig 로 확인

게스트 IP : VirtualBox Ubuntu 의 IP
Ubuntu 의 terminal 에 hostname -I 로 확인

데이터베이스 접속 프로그램 DBeaver 사용


Server Host : 호스트 Windows 의 IP
포트 포워딩(Windows IP -> Ubuntu IP) 설정이 되었기 때문에, 호스트 Windows 의 IP 로 Ubuntu 에 접속할 수 있다.
Username 과 Password 를 입력한 후
Test Connection 을 통해 접속 테스트
