LoginSignup
1
1

More than 5 years have passed since last update.

【ComputeEngine】CentOS6でのMySQLの外部公開

Posted at

Google Compute EngineでCentOS6のMySQLの外部公開の設定を行ったのでそのメモ。
ComputeEngineは月間無料枠もあるし、最安プランなら月5ドル程度なのでかなり良いと思ってます。

① MySQLで接続ユーザーの権限設定を行う
「Linux(CentOS)のMySQLへ外部接続する | 俺の開発研究所」
http://itmemo.net-luck.com/linux-centos-mysql-remote/

② CentOSでiptablesでポートを公開する
※ portが3306のとき

#iptablesの設定を編集
$ sudo vi /etc/sysconfig/iptables

# HTTP
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -jcreate database ACCEPT

#iptablesの再起動

$ sudo  /etc/rc.d/init.d/iptables restart

③ ComputeEngineのファイアウォール設定を変更する
「Google Compute Engineのファイヤーウォールを理解する #gcpja | Developers.IO」
http://dev.classmethod.jp/cloud/gce-firewall/

ソースIP
0.0.0.0/0
ポート
tcp:3306
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1