1

我正在阅读 Django 教程,但遇到了一些麻烦,因为我使用 MySQL 作为我的数据库。

当我跑

    python manage.py test polls

我明白了

    Creating test database for alias 'default'...
    Got an error creating the test database: (1044, "Access denied for user 'USER123'@'%' to database 'test_USER123'")
    Type 'yes' if you would like to try deleting the test database 'test_USER123', or 'no' to cancel:

这是我的 settings.py

    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
            'NAME': 'USER123',                      # Or path to database file if using sqlite3.
    # The following settings are not used with sqlite3:
            'USER': 'USER123',
            'PASSWORD': 'PASSWORD',
            'HOST': '',                      # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
            'PORT': '',                      # Set to empty string for default.
}

}

我想知道是否有人会向我解释出了什么问题以及发生了什么。谢谢!

4

0 回答 0