Hi I'm trying to connect from python to MySQL but I can't apparently due to below error. I tried it with this...
import MySQLdb
cnx = MySQLdb.connect(user ='phpmyadmin',
passwd ='raspberry',
host ='192.168.0.58',
database ='freddy')
print 'connected'
cnx.close()
and then i changed "Mysqldb" to "Mysql.connector" but doesnt work. This is the error showing :
Traceback (most recent call last): File "test.py", line 2, in cnx = MySQLdb.connect(user='phpmyadmin',passwd='raspberry',host='192.168.0.58',database='freddy') File "/usr/lib/python2.7/dist-packages/MySQLdb/init.py", line 81, in Connect return Connection(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 204, in init super(Connection, self).init(*args, **kwargs2) TypeError: 'database' is an invalid keyword argument for this function ....
what should i do? i know my password its fine, but must be somethig else...