원본글 : https://zetawiki.com/wiki/MySQL_%EC%9B%90%EA%B2%A9_%EC%A0%91%EC%86%8D_%ED%97%88%EC%9A%A9


mysql -uroot -p


use mysql;


SELECT Host,User,plugin,authentication_string FROM mysql.user;


GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password';


FLUSH PRIVILEGES;


netstat -ntlp | grep mysqld    (127.0.0.1:3306) 이렇게 되있어서 로컬 호스트에서만 접속가능


vi /etc/mysql/my.cnf

아래와 같이 설정해준다.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
# If the same option is defined multiple times, the last one will apply.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
 
#
# This group is read both both by the client and the server
# use it for options that affect everything
 
[client-server]
 
 
 
 
# Import all .cnf files from configuration directory
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/
[mysqld]
bind-address=0.0.0.0
 
 
cs


service mysql restart


netstat -ntlp | grep mysqld  (0 0.0.0.0:3306) 이렇게 바뀌어서 외부접속이 허용가능하다.


접속을 해보면 정상적으로 될 것이다.


이렇게 해도 안된다.


/etc/mysql/mariadb.conf.d


이동하여
 vi 50-server.cnf


수정해준다.

[재시작]
service mysql restart

[네트워크확인]
netstat -ntlp | grep mysqld



외부에서 접속해본다. 




'Ubuntu' 카테고리의 다른 글

composer install 오류 php7.2  (0) 2020.04.04
git 설치 및 설정  (0) 2020.04.04
marialdb database 생성 및 권한주기  (0) 2019.12.30
php7.2 curl 설치  (0) 2019.12.30
composer 설치하기  (0) 2019.12.30

+ Recent posts