Connecting to MySQL over network
Hi,
I am just 1 day old with python. I use Bash for doing most of the scripting. Thought of giving python a try. I installed mysql.connector module and I used the code posted in http://
#!/usr/bin/python
import mysql.connector
if __name__ == "__main__":
db = mysql.connector
cursor = db.cursor()
cursor.
for row in cursor.fetchall():
print row
cursor.close()
db.close()
When I run the script, its giving me error.
$ ./3.py
Traceback (most recent call last):
File "./3.py", line 5, in <module>
db = mysql.connector
File "/usr/lib/
return MySQL(*args, **kwargs)
File "/usr/lib/
self.
File "/usr/lib/
self.
File "/usr/lib/
self.
File "/usr/lib/
raise errors.
mysql.connector
I am sure that I am missing something here. Would appreciate if you can point me out what I am doing wrong here. Thanks in advance.
Regards,
Kurian Thayil.
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- Geert JM Vanderkelen Edit question
- Solved by:
- Geert JM Vanderkelen
- Solved:
- Last query:
- Last reply: