Web2py没有连接到MySQL数据库

2024-05-29 11:00:38 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个系统运行在googleappengine的Python和web2py上。 在与Google云SQL数据库连接之前。 现在我需要它连接到DreamHost的数据库。在

db = DAL ('mysql: // User: senha@mysql-apollo-apollo.apollosolucoes.com/bancodedados' driver_args = {
        }, Migrate_enabled = False, lazy_tables = True)

这就产生了这个错误:

Traceback (most recent call last):   File "/base/data/home/apps/s~apollo-solutionworkshop/teste2.386857474473035619/gluon/restricted.py", line 220, in restricted     exec ccode in environment   File "/base/data/home/apps/s~apollo-solutionworkshop/teste2.386857474473035619/applications/frontend/models/b_db.py", line 12, in     }, Migrate_enabled = False, lazy_tables = True)   File "/base/data/home/apps/s~apollo-solutionworkshop/teste2.386857474473035619/gluon/dal.py", line 7867, in init     raise RuntimeError ("Failure to connect, tried% d times: \ n% s"% (attempts, tb)) RuntimeError: Failure to connect, tried 5 times: Traceback (most recent call last):   File "/base/data/home/apps/s~apollo-solutionworkshop/teste2.386857474473035619/gluon/dal.py", line 7845, in init     self._adapter = ADAPTERS [self._dbname] (** kwargs)   File "/base/data/home/apps/s~apollo-solutionworkshop/teste2.386857474473035619/gluon/dal.py", line 688, in call     obj = super (AdapterMeta, cls) .__ call __ (* args, ** kwargs)   File "/base/data/home/apps/s~apollo-solutionworkshop/teste2.386857474473035619/gluon/dal.py" line in 2728, in init     if do_connect: self.reconnect ()   File "/base/data/home/apps/s~apollo-solutionworkshop/teste2.386857474473035619/gluon/dal.py", line 648, in reconnect     self.connection = f ()   File "/base/data/home/apps/s~apollo-solutionworkshop/teste2.386857474473035619/gluon/dal.py" line in 2726, in connector     self.driver.connect return (** driver_args)   File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/MySQLdb-1.2.4b4/MySQLdb/init.py", line 81, in Connect     return Connection (* args, ** kwargs)   File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/MySQLdb-1.2.4b4/MySQLdb/connections.py", line 190, in init     super (Connection, self) .__ init __ (* args, ** kwargs2) OperationalError: (2005, "Unknown MySQL server host 'mysql-apollo-apollo.apollosolucoes.com' (-1)")

在程序SQLyog中输入更多的用户和密码,以及数据库,我可以完美地连接。在

当连接到Google云SQL数据库时是这样的:

^{pr2}$

Tags: appsinpyselfhomedatabaseinit

热门问题