PythonライブラリMySQLdbをインストールするために、データをjsonからmysqlに転送したいと思います。正常にインポートされますが、接続中にエラーが発生します
>>> import MySQLdb
>>> db=MySQLdb.connect(passwd="king123",db="thangs")
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
db=MySQLdb.connect(passwd="king123",db="thangs")
File "C:\Python27\lib\site-packages\MySQLdb\__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (2003, "Can't connect to MySQL server on 'localhost' (10061)")
>>> import _mysql
>>> db=_mysql.connect()
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
db=_mysql.connect()
OperationalError: (2003, "Can't connect to MySQL server on 'localhost' (10061)")
db = MySQLdb.connect(passwd = "rat123"、db = "thangs"、host = "localhost"、port = 1028、user = "mroot")
Traceback (most recent call last):
File "<pyshell#41>", line 1, in <module>
db=MySQLdb.connect(passwd="king123",db="thangs",host="localhost",port=1028,user="munieb")
File "C:\Python27\lib\site-packages\MySQLdb\__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (2013, "Lost connection to MySQL server at 'waiting for initial communication packet', system error: 2")