Ask Your Question
1

django cannot create test database

asked 2021-09-07 15:07:33 -0500

piscvau's avatar

I created a django project and a testCase with setUpTestData containing several objects.create. when I debug the test , I get the following error : I get the following error : Got an error creating the test database: (1044, "Access denied for user 'odile'@'localhost' to database 'test_recettes_database'")

I am using mySQL and my django settings module is using a .env file in my virtual environment. Any help will be welcomed

edit retag flag offensive close merge delete

Comments

It seems it is due to mysql on Ubuntu which does not allow the creation of the database unless the user is connected as sudo. It seems therefore that Wing has nothing to do with it. I need to create the database outside and tell django test to load the database with my test data. But how can I do this?

piscvau's avatar piscvau  ( 2021-09-08 03:03:50 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-09-08 05:44:50 -0500

piscvau's avatar

problem solved. It comes from mysql8 which uses plugin caching_sha2_password . So changing in mysql the plugin to mysql_native_password solves the problem

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2021-09-07 15:07:33 -0500

Seen: 231 times

Last updated: Sep 08 '21