Django Python manage.py test error, error prompt:
Creating test database for alias ‘postgres’…
Got an error creating the test database: permission
Creating test database for alias ‘postgres’…
Got an error creating the test database: permission
Django Settings:
DBNAME = 'multi_test'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
},
'mysql': {
'ENGINE': 'django.db.backends.mysql',
'NAME': DBNAME,
'USER': 'root',
'PASSWORD': 'xxx',
'HOST': '127.0.0.1',
'PORT': 3306,
'OPTIONS': {
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
},
},
'postgres': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': DBNAME,
'USER': 'root',
'PASSWORD': 'xxx',
'HOST': '127.0.0.1',
'PORT': 5432,
},
}
Python manager.py Migrate will work fine
Solutions:
Add createdB access to the PostgresQL database for root (the ‘USER’ corresponding to ‘Postgres’ in Settings)
wenjie@digi007:~/study/dbtest/multi_dbs$ su - postgres
Password:
postgres@digi007:~$ psql
psql (9.6.2)
Type "help" for help.
postgres=# alter user root createdb;
will no longer report an error when you rerun test.
Read More:
- ArchLinux starts error after modifying MariaDB database path Can’t create test file /xxxxx/xxxxx-test
- [Solved] bee must have one register DataBase alias named `default`
- Postgres Multiple data insertion error: The ‘default‘ dialect with current database version settings does not support
- Eureka unit test error creating bean with name ‘Eureka autoservice registration’: Singleton bean
- [Solved] There are test failures. Please refer to D:\Java_study\springboot\springboot-sugon-3\target\surefire-reports for the individual test results.
- [Solved] Android Room: Database Common Error ‘missing database’
- [Solved] error: password authentication failed for user “postgres”
- DB::Exception: test: Authentication failed: [How to Solve]
- Execute an error under pytest cmd make sure your test modules/packages have valid Python names.
- Mybatis Connect Database Error: Error querying database. Cause: java.sql.SQLException: The server time zone value..
- SVN ERROR (E200033): database is locked [How to Solve]
- How to Solve golang test Error: # command-line-arguments [command-line-arguments.test]
- [Solved] docker: Error response from daemon: driver failed programming external connectivity on endpoint mysql-test …
- [Solved] Docker Error: got permission denied while trying to connect to the docker daemon socket at…
- [Solved] Interface automation test: JSON parse error
- Mavenzai install Error: There are test failures
- [Go] Testing when solving go test: warning: no tests to run
- JMeter JDBC Error: No pool found named: ‘test‘ [How to Solve]
- Cobbler status error pxe-e61: Media test failure, check cable
- [Solved] Canoe CAPL Error: “the test module is not assigned or invalid”