在编写单元测试时,每次重新创建MySQL数据库表都花费很长时间,于是在表结果不变的情况下,想使用keepdb参数,即执行 python manage.py test --keepdb, 会报如下错误
1 2
Using existing test database for alias 'default'... Got an error creating the test database: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL serverversionfor the right syntax touse near 'CREATE DATABASE IF NOT EXISTS `test_tdcmdb` CHARACTER SET utf8mb4;\n 'at line 2")