LoginSignup
1
3

More than 5 years have passed since last update.

EC2からRDSへの接続

Last updated at Posted at 2019-02-04

EC2からRDS(mysql)に接続

前回EC2内にデータベースを作成してデータの参照を行ったが今回は
RDSを使用してデータの参照を行うようにした

参考PHPでPDOを利用してMySQL(RDS)に接続する

PODの設定

$pdo = new PDO(
        'mysql:host={エンドポイント};dbname={データベースの名前};charset=utf8',
        'マスターユーザの名前',
        'マスターパスワード'
    );

*データベースのセキュリティグループのソースを変更すること

RDSへのログイン

mysql -h wcup2006.cxzzbjlelesy.ap-northeast-1.rds.amazonaws.com -P 3306 -u root -p

sqlのインストール
sudo yum install mysql

1
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
1
3