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.

Recommended Answers

All 2 Replies

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.