Miguel, MySQL can communicate over either TCP or a named pipe. It's possible that your MySQL server is only listening on the named pipe. I could imagine that the mysql command line client would connect successfully over this channel, but Python would try to connect to the TCP socket and fail.
Try telnetting to the local mysql port and see what happens: telnet localhost 3306 If you get an error like "connection refused", then this is almost certainly the problem. Take a look at your mysql config file (/etc/ mysql/my.cnf or similar) and look for the bind-address or skip- networking settings. Kevin On Mar 15, 11:08 am, Miguel <miguel.miran...@gmail.com> wrote: > Hello to all, I have created a new project using the web wizard, for > some unknown reason the mysql connection is not working, this is the > uri im using: > > mysql://cmts_monitor:cmtsTigoHome@localhost/cmts_monitor > > and this is the error i got: > > Traceback (most recent call last): > File "/home/www-data/web2py/gluon/restricted.py", line 188, in > restricted > exec ccode in environment > File "/home/www-data/web2py/applications/CMTS_Monitor/models/db.py", > line 17, in <module> > db = DAL('mysql://cmts_monitor:cmtsTigoHome@localhost/ > cmts_monitor') # if not, use SQLite or other DB > File "/home/www-data/web2py/gluon/dal.py", line 3423, in __init__ > raise RuntimeError, "Failure to connect, tried 5 times:\n%s" % > error > RuntimeError: Failure to connect, tried 5 times: > (2003, "Can't connect to MySQL server on 'localhost' (111)") > > i have tested the username/password combination in the command line, > it works fine: > > mmiranda@appsrv01:/var/log/check_cmts$ mysql --user cmts_monitor -- > database cmts_monitor --host=localhost -p > Enter password: > Welcome to the MySQL monitor. Commands end with ; or \g. > Your MySQL connection id is 20510 > Server version: 5.1.37-1ubuntu5.5 (Ubuntu) > > Type 'help;' or '\h' for help. Type '\c' to clear the current input > statement. > > mysql> > > What should i check? > regards