error connecting to mysql

730 views
Skip to first unread message

Andrea Fae'

unread,
Feb 13, 2019, 3:46:19 PM2/13/19
to web2py-users
Hello. I have this error when I start application "ga"

Error ticket for "ga"

Ticket ID

127.0.0.1.2019-02-13.20-49-28.fcc1a494-3aa4-42c2-b1a9-ab14a466e72e

<type 'exceptions.RuntimeError'> Failure to connect, tried 5 times: Traceback (most recent call last): File "C:\web2py\gluon\packages\dal\pydal\base.py", line 454, in __init__ self._adapter = adapter(**kwargs) File "C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, in __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 368, in __init__ super(SQLAdapter, self).__init__(*args, **kwargs) File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 52, in __init__ self.reconnect() File "C:\web2py\gluon\packages\dal\pydal\connection.py", line 172, in reconnect self.connection = self.connector() File "C:\web2py\gluon\packages\dal\pydal\adapters\mysql.py", line 52, in connector return self.driver.connect(**self.driver_args) File "C:\web2py\gluon\contrib\pymysql\__init__.py", line 90, in Connect return Connection(*args, **kwargs) File "C:\web2py\gluon\contrib\pymysql\connections.py", line 688, in __init__ self.connect() File "C:\web2py\gluon\contrib\pymysql\connections.py", line 905, in connect self._get_server_information() File "C:\web2py\gluon\contrib\pymysql\connections.py", line 1231, in _get_server_information self.server_charset = charset_by_id(lang).name File "C:\web2py\gluon\contrib\pymysql\charset.py", line 38, in by_id return self._by_id[id] KeyError: 255

Versione

web2py™Version 2.16.1-stable+timestamp.2017.11.14.05.54.25

Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
Traceback (most recent call last):
File "C:\web2py\gluon\restricted.py", line 219, in restricted
exec(ccode, environment)
File "C:/web2py/applications/ga/models/db.py", line 34, in <module>
check_reserved=['all'])
File "C:\web2py\gluon\packages\dal\pydal\base.py", line 169, in __call__
obj = super(MetaDAL, cls).__call__(*args, **kwargs)
File "C:\web2py\gluon\packages\dal\pydal\base.py", line 474, in __init__
"Failure to connect, tried %d times:\n%s" % (attempts, tb)
RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
File "C:\web2py\gluon\packages\dal\pydal\base.py", line 454, in __init__
self._adapter = adapter(**kwargs)
File "C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, in __call__
obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 368, in __init__
super(SQLAdapter, self).__init__(*args, **kwargs)
File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 52, in __init__
self.reconnect()
File "C:\web2py\gluon\packages\dal\pydal\connection.py", line 172, in reconnect
self.connection = self.connector()
File "C:\web2py\gluon\packages\dal\pydal\adapters\mysql.py", line 52, in connector
return self.driver.connect(**self.driver_args)
File "C:\web2py\gluon\contrib\pymysql\__init__.py", line 90, in Connect
return Connection(*args, **kwargs)
File "C:\web2py\gluon\contrib\pymysql\connections.py", line 688, in __init__
self.connect()
File "C:\web2py\gluon\contrib\pymysql\connections.py", line 905, in connect
self._get_server_information()
File "C:\web2py\gluon\contrib\pymysql\connections.py", line 1231, in _get_server_information
self.server_charset = charset_by_id(lang).name
File "C:\web2py\gluon\contrib\pymysql\charset.py", line 38, in by_id
return self._by_id[id]
KeyError: 255

In file: C:\web2py\applications\ga\models\db.py

1.
<code object <module> at 000000000AC93830, file "C:\web2py\applications\ga\models\db.py", line 8


This is my appconfig.ini:

; App configuration
[app]
name = Welcome
author = Your Name <you@example.com>
description = a cool new app
keywords = web2py, python, framework
generator = Web2py Web Framework

; Host configuration
[host]
names = localhost:*, 127.0.0.1:*, *:*, *

; db configuration
[db]
uri = mysql://root:passwordroot@localhost/gadb?set_encoding=utf8mb4
migrate = true
pool_size = 10 ; ignored for sqlite

; smtp address and credentials
[smtp]
server = smtp.gmail.com:587
sender = y...@gmail.com
login = username:password
tls = true
ssl = true

; form styling
[forms]
formstyle = bootstrap3_inline
separator =
I just created the db "gadb" in mysql.exe. You can see the db, but I only created the db with the command

mysql> create database gadb; Query OK, 1 row affected (0.02 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | gadb | | information_schema | | mysql | | performance_schema | | sakila | | sys | | world | +--------------------+ 7 rows in set (0.00 sec)

Can you help me what is my mistake?
THANK YOU

Andrea Fae'

unread,
Feb 14, 2019, 1:50:21 PM2/14/19
to web...@googlegroups.com
This database gadb is without tables.

Andrea Fae'

unread,
Feb 19, 2019, 3:53:50 PM2/19/19
to web2py-users
I solved the problem. It was a problem regarding foreign keys. I delete this binding and it worked. Thank you the same.
Reply all
Reply to author
Forward
0 new messages