3
3

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 5 years have passed since last update.

GCE にmysqlをインストールして、外部からmysqlにアクセス可能にするまで

Posted at

インスタンスを作成

  • machine-typeは最小(f1-micro)を選択
$ gcloud compute instances create redash-datasource --machine-type f1-micro

fire-wallで3306ポートからアクセス可能にする

mysqlをVM にインストールする

bind-address を変更する

今回は、どこからでもアクセス可能にする。

$ vi /etc/mysql/mariadb.conf.d/50-server.cnf
bind-address            = 0.0.0.0

に変更

serviceをrestart

sudo /etc/init.d/mysql restart
sudo vi /etc/mysql/mariadb.conf.d/

mysqlでDBを作成

$ sudo mysql -u root 
mysql> CREATE [DATABASE_NAME]  DEFAULT CHARACTER SET utf8;

root userは全てのportからアクセスできるように設定

mysql> grant all privileges on [DB_NAME].* to root@"%" identified by 'root' with grant option;
3
3
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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?