Example for using MySQL
java at dejazzd.com
Fri Nov 9 19:30:10 CET 2001
There are examples included with the MySQLdb code.
On my development machine, I only need to do this to connect and query
db = MySQLdb.connect(db="test")
cursor = db.cursor()
cursor.execute('select * from test')
results = cursor.fetchall()
On our web server, where the mysql database is shared, I need to do
this to connect:
db = MySQLdb.connect(user="myuser", passwd="mypassword", db="mydb",
- the unix_socket string is because this file is not in the standard
location on this particular web server.
There are quite a few options for the connect() method, so get your
hands on the docs that come with MySQLdb.
"Andreas Penzel" <mail at andreas-penzel.de> wrote in message news:<9sg7t8$12a85q$1 at ID-69142.news.dfncis.de>...
> Hello NG!
> Where can I find an example for using MySQL in Python (specially how to
> connect to the DB)?
> Thanks, Andreas
More information about the Python-list