I am working with django.test
package in my project, and have implemented some testcases. I have a MySQL database, and have created a test database with no problem.
But now when I am running my tests it shows the below error.
Type 'yes' if you would like to try deleting the test database 'test_sepantadb', or 'no' to cancel: Creating test database for alias 'default'...
Got an error creating the test database: (1007, "Can't create database 'test_sepantadb'; database exists")
And after I type yes to the console, it shows the below errors, and I don't know how to solve them.
Destroying old test database for alias 'default'...
Traceback (most recent call last):
File "D:\ABDAL\SepantaEnv\lib\site-packages\django\db\backends\utils.py", line 82, in _execute
return self.cursor.execute(sql)
File "D:\ABDAL\SepantaEnv\lib\site-packages\django\db\backends\mysql\base.py", line 73, in execute
return self.cursor.execute(query, args)
File "D:\ABDAL\SepantaEnv\lib\site-packages\pymysql\cursors.py", line 148, in execute
result = self._query(query)
File "D:\ABDAL\SepantaEnv\lib\site-packages\pymysql\cursors.py", line 310, in _query
conn.query(q)
File "D:\ABDAL\SepantaEnv\lib\site-packages\pymysql\connections.py", line 548, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "D:\ABDAL\SepantaEnv\lib\site-packages\pymysql\connections.py", line 775, in _read_query_result
result.read()
File "D:\ABDAL\SepantaEnv\lib\site-packages\pymysql\connections.py", line 1156, in read
first_packet = self.connection._read_packet()
File "D:\ABDAL\SepantaEnv\lib\site-packages\pymysql\connections.py", line 725, in _read_packet
packet.raise_for_error()
File "D:\ABDAL\SepantaEnv\lib\site-packages\pymysql\protocol.py", line 221, in raise_for_error
err.raise_mysql_exception(self._data)
File "D:\ABDAL\SepantaEnv\lib\site-packages\pymysql\err.py", line 143, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1050, "Table 'react_arimapredictedvalues' already exists")
I have tried the solution which have been provided in this link. But it does not solve it for me.
I have also run the below command for the second time in my MySQL shell to check the privileges, but again nothing does not change.
mysql> GRANT ALL PRIVILEGES ON test_sepantadb.* TO 'sepanta'@'localhost';
Query OK, 0 rows affected (0.00 sec)
I have also tried two other solutions. I have deleted the test databse from mysql
shell with command prompt, and also change my test database name, but none of these two solutions solved my problem.
These are also the content of my django_migrations
table in test_sepantadb
database:
I will be grateful for any help or advice on how to solve this error.