0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

mysql 外部サーバーからアクセス

Posted at

外部からのアクセスを許可するために、設定ファイルを編集

$ sudo -e /etc/mysql/mysql.conf.d/mysqld.cnf

下記の行をコメントアウトする

bind-address = 172.0.0.1

再起動

$ sudo service mysql restart

ポートを開放 (デフォは3306)

$ sudo apt-get install ufw
$ sudo ufw allow 3306

mysqlにログインして、外部から接続できるユーザを作る。
例:username: public password:publicの場合

mysql> grant all privileges on *.* to public@"%" identified by 'public' with grant option;
mysql>  select user,host from mysql.user;

設定したuserのhostが%になっていればOK
+------------------+------------+
| user | host |
+------------------+------------+
| public | % |

クライアントは今回windowsで、MySQL Workbenchを入れた
無事表示できた

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?