我正在做一个学校项目。这是一个基本上很简单的练习,我应该创建3个表。我决定使用Python,在this guide之后,我编写了以下代码:
mydb = mysql.connector.connect(
host = 'localhost',
user = 'admin',
passwd = 'admin',
database = 'primo'
)
cursor = mydb.cursor()
cursor.execute("CREATE DATABASE primo")
当我尝试执行它时,它返回:
mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on 'localhost:3306' (10061 No connection could be made because the target machine actively refused it)
我想在本地运行它;如果我将“localhost”更改为“127.0.01”,则会显示端口错误(不过我认为最好使用“localhost”)
目前没有回答
相关问题 更多 >
编程相关推荐