wiki:InstallationGuidelines/MySQL

Version 4 (modified by Praneeth Bodduluri, 15 years ago) ( diff )

--

Installation on MySQL

Replacing the simple SQLite database with MySQL allows greater scalability

Note : 1) The databases directory contains what web2py knows about your database
2) You need to set Migrate=True in 00_db.py before you update the code and switch back to Migrate = False later on.
3) In case of database mismatches - check the databases directory for the appropriate table ( cat the file ) and change accordingly.

Install Python support for MySQL:

apt-get install python-mysqldb

or

wget http://downloads.sourceforge.net/project/mysql-python/mysql-python-test/1.2.3c1/MySQL-python-1.2.3c1.tar.gz
tar zxvf MySQL-python-1.2.3c1.tar.gz
cd MySQL-python-1.2.3c1
python setup.py install

Create the database 1st:

mysqladmin --user=root -p create sahana
mysql -p
 GRANT USAGE ON sahana.* TO 'sahana'@'localhost' IDENTIFIED BY 'mypassword';

Suggest to use connection pools to reuse connections in models/00_db.py:

db=SQLDB('mysql://user:password@hostname/sahana',pools=20)

How many pools?

whatever you choose it always starts with one and grows with the
number of concurrent requests up to the value of pools (the max number
of concurrent pools). So pools should be the max number of concurrent
requests you expect. That is the max value of:
<number of requests/second> / <average time per request in seconcds> 

InstallationGuidelines

Note: See TracWiki for help on using the wiki.