问题描述:

I'm trying connect Google Cloud SQL with SSL on my Rails APP, use mysql cli with sslca, everything is fine.

$ mysql --ssl-ca=config/server-ca.pem --host=instance-ip --user=username --password

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1535

Server version: 5.6.26 (Google)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

This is my database.yml

development:

adapter: mysql2

encoding: utf8

pool: 5

username: username

password: userpassword

host: instance-ip

database: RailsDB

sslca: config/server-ca.pem

When I start rails server and try to access my website it show up

Mysql2::Error (Access denied for user 'username'@'my-public-ip' (using password: YES))

This confused me, it should be connect to Google Cloud SQL instance IP, but it change to my public IP??

Have any idea? Thanks for your watch

相关阅读:
Top