Skip to main content

The django4 version prompts django.db.utils.NotSupportedError: MySQL 8 or later is required (found 5.7.26)

When I was learning django recently, I got the following error when executing python manage.py migrate: django.db.utils.NotSupportedError: MySQL 8 or later is required (found 5.7.26). 1.png

2.png

According to the information, the local mysql version is relatively low. After searching on Baidu, I found that Django 3.2 and higher require MySQL 8.0.25 or higher. My local mysql version is 5.7.26. But what if I don’t want to pretend anymore? Can I comment out the mysql version check?

  1. Enter python at the cmd command line

3.png

  1. Import django django to view the installation path of django

4.png

You can see that my directory is D:\python\Lib\site-packages\django. The complete directory is: D:\python\Lib\site-packages\django\db\backends\base. Open base.py in the base directory and find it. self.check_database_version_supported() and comment it out

5.png

Just run python manage.py migrate again

6.png

There are more tables in the database that can be viewed

7.png

As for what database problems I will encounter in the subsequent development, it is still unknown. I am just learning it now, so I will record it here.