Google SQL Database user and password - where to set?

38 views
Skip to first unread message

Karoly Kantor

unread,
Apr 22, 2017, 9:45:49 AM4/22/17
to web...@googlegroups.com
A very simple question:
I am trying to move to Google Cloud SQL.
I created an SQL instance with Google, where I had to set a data base user name and password.

Where do i set that in my app engine web2py app?

Currently i have this in app.yaml, as prescribed by the Google Cloud Website:

env_variables:
    CLOUDSQL_CONNECTION_NAME: my-project:europe-west1:sql-instance-1
    CLOUDSQL_USER: root
    CLOUDSQL_PASSWORD: pw

but i get refused by the SQL instance.

This is what I have in db.py:

db = DAL('google:sql://my-project:sql-instance-1/databasename')

Karoly Kantor

unread,
Apr 24, 2017, 11:49:13 AM4/24/17
to web...@googlegroups.com
More info: This in the log:

DEBUG: connect attempt 4, connection error: Traceback (most recent call last): File "/base/data/home/apps/e~my-project/2.400786701713097994/gluon/packages/dal/pydal/base.py", line 446, in __init__ self._adapter = ADAPTERS[self._dbname](**kwargs) File "/base/data/home/apps/e~my-project/2.400786701713097994/gluon/packages/dal/pydal/adapters/base.py", line 60, in __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) File "/base/data/home/apps/e~my-project/2.400786701713097994/gluon/packages/dal/pydal/adapters/google_adapters.py", line 59, in __init__ if do_connect: self.reconnect() File "/base/data/home/apps/e~my-project/2.400786701713097994/gluon/packages/dal/pydal/connection.py", line 104, in reconnect self.connection = f() File "/base/data/home/apps/e~my-project/2.400786701713097994/gluon/packages/dal/pydal/adapters/google_adapters.py", line 57, in connector return rdbms.connect(**driver_args) File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/rdbms.py", line 70, in connect password=password) File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/storage/speckle/python/api/rdbms.py", line 813, in __init__ self.OpenConnection() File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/storage/speckle/python/api/rdbms.py", line 836, in OpenConnection response = self.MakeRequest('OpenConnection', request) File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/storage/speckle/python/api/rdbms.py", line 947, in MakeRequest raise _ToDbApiException(response.sql_exception) 
InternalError: (0, u'Not authorized to access instance: my-project:europe-west1:sql-instance-1') 
Reply all
Reply to author
Forward
0 new messages