【发布时间】:2012-06-19 08:04:02
【问题描述】:
Exception Type: OperationalError at /
Exception Value: (1049, "Unknown database 'database'")
目前我尝试了这个:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'database', # Or path to database file if using sqlite3.
'USER': 'root', # Not used with sqlite3.
'PASSWORD': '****', # Not used with sqlite3.
'HOST': '/var/lib/mysql/database/', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '80', # Set to empty string for default. Not used with sqlite3.
}
}
如果我没有指定主机,我会收到此错误:
OperationalError at /
(2002, "Can't connect to local MySQL server through socket '/var/lib/mysql/database' (13)")
可以是有权限的东西吗?
提前感谢:)
【问题讨论】:
-
你在mysql中创建了db“数据库”吗?
标签: python mysql django amazon-ec2 database-connection