[Tutor] Distributing MySQL with my application

Alan Gauld alan.gauld at btinternet.com
Tue Mar 24 00:40:39 CET 2009


"Lauren Snyder" <lauren at protopc.com> wrote

> 1. how do I create a database that is not in users localhost? Currently I
> just use MySQL's "create [database]" command after I connect using
> MySQLdb.connect

The connect string should include the machine/port information.

> Alan mentioned something about
> "Do you not use an environment variable or config file to allow
> the user to select where the database server runs?"

Read the machine/port details from the config file or environment var
and use those in the connect string.

> 2. I also like the idea of writing a script to check to see if MySQL is
> installed. However, I need pointers on writing this script and also the
> script to auto install MySQL on another user's computer.

Does it need to be MySql? If you aren't using a lot of MySql specific
SQL you might be better changing toSQLite whichis part of the
standard Python library and has the advantage that it is easy to
distrribute, being just a single file. The regular py2exe conversion
will then bundle all the stuff you need into your single exe file. It's
much easier than MySql for this kind of thing and pefectly adequate
if you aren't managing huge databases(ie millions of records).

Just a thought,

Alan G 




More information about the Tutor mailing list