「CentOS7入門」MySQLにクライアントでリモート接続するの設定方法

1.3306のポートを開放
#firewall-cmd –permanent –zone public –add-port 3306/tcp

2.MySQLサービスをゾーンに追加
# firewall-cmd –permanent –zone public –add-service mysql
success
# firewall-cmd –reload
success

3.ファイアウォールに設定を反映
# firewall-cmd –info-zone public
public (active)
target: default
icmp-block-inversion: no
interfaces: eth0
sources:
services: dhcpv6-client http mysql ssh
ports: 3306/tcp 80/tcp
protocols:
masquerade: no
forward-ports:
sourceports:
icmp-blocks:
rich rules:

4.設定変更
MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO root@”xxx.xxx.xxx.xxx” IDENTIFIED BY ‘ygl989195’ WITH GRANT OPTION;GRANT ALL PRIVILEGES ON *.* TO root@”xxx.xxx.xxx.xxx” IDENTIFIED BY ‘ygl989195’ WITH GRANT OPTION;

MariaDB [(none)]> flush PRIVILEGES;

5.ポート確認
MariaDB [(none)]> SHOW VARIABLES LIKE ‘port’;
+—————+——-+
| Variable_name | Value |
+—————+——-+
| port | 3306 |
+—————+——-+

Comments are closed.