我有以下代码:
import mysql.connector
conn=mysql.connector(user="B13046",password="Likhi46",host="localhost")
但是我收到以下错误:
Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'module' object is not callable
我该如何解决追溯问题?
答案 0 :(得分:0)
您应该使用mysql.connector.connect
:
import mysql.connector
conn=mysql.connector.connect(user="B13046",password="Likhi46",host="localhost")
有关更多功能,请参见the documentation