Hi Zhe, When you start web2py do you see a message like this: (I use python web2py.py at command line) Database Drivers Available: SQLite3, MySQL
if you don't see MySQL, it means the python driver to connect to MySQL is not available. You need to download it for the version of python you are running: http://sourceforge.net/projects/mysql-python. Check the DAL documentation: http://web2py.com/book/default/chapter/06#The-Database-Abstraction-Layer Thanks, rAm i Think, i Wait, i Fast -- Siddhartha http://sodidi.ramjeeganti.com On Thu, Aug 5, 2010 at 5:08 PM, Zhe Li <linuxcity...@gmail.com> wrote: > Hi, > > I am using ngnix+fcgi with web2py. Just today I switched the database > from SQLite to MySQL. But it seems web2py failed to connect to mysql > if using fcgi+ngnix. Launch it by "python web2py.py" works fine. > > The error looks like this: > > Error traceback > Traceback (most recent call last): > File "/home/zhe/web2py/gluon/restricted.py", line 178, in restricted > exec ccode in environment > File "/home/zhe/web2py/applications/init/models/db.py", line 16, in > <module> > db = DAL('mysql://web2py:lindge1...@localhost/lab') > File "/home/zhe/web2py/gluon/sql.py", line 3887, in DAL > raise RuntimeError, "Failure to connect to DB. Tried 5 times" > RuntimeError: Failure to connect to DB. Tried 5 times > > Could anyone tell me what to do? Thanks! > > Cheers, > Zhe >