0

Can someone please write the script for connecting to MySQLdb

Also if anyone knows a good tutorial form transfering info from a python module into a MySQL table.

Thanks in advance.

2
Contributors
2
Replies
3
Views
11 Years
Discussion Span
Last Post by rubiton
0

import MySQLdb

conn = MySQLdb.connect (host = "localhost",
user = "testuser",
passwd = "testpass",
db = "test")
cursor = conn.cursor ()
cursor.execute ("SELECT VERSION()")
row = cursor.fetchone ()
print "server version:", row[0]
cursor.close ()
conn.close ()


The answere for someone searching the forum in future, thanks for the help guys :( but I found it myself.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.