Can't connect DB created by MySQL to Django project

Hey everyone !

I was following the 8th lesson of the Django course, as for the creation of a database, instead of using DataGrip, I was thinking to use MySQL, as I’d already installed it on my laptop.
Unfortunately, I’m not confident user of MySQL, anyway I tried to create a database and then tried to connect it to the Django project, but when I want to migrate it, I’m getting the following error.
I don’t know what I’m missing here, please advise how to fix it and go further.

Thank you in advance !!

Got an error checking a consistent migration history performed for database connection ‘default’: (1049, “Unknown database ‘storefront’”)

1 Like

i am also not using DataGrip but instead MySQL Workbench - as its for free.
Did you also install MySQL Workbench?
Anyhow, once you have created the DB with MySQL Workbench, you can update the DBs (called schemas in MySQL workbench) to verify if you the DB was actually created.
Have you verified that?

1 Like

Thank you for your feedback!

Now I’ll try your suggestion, I think to have MySQL workbench as well, anyway I’ll try and let you know!

I’ve verified the created DB, but I think I’ve only created an empty DB, because on the left side I see old tables of my old exercises that are not related to the created DB.

Where do I have to keep the created DB ?

Inside the Django project folder ? how can I put the path to source from one folder to another, I mean to connect them ?

I think I’m making a confusion with this DB creation.
Anyway I confirm that I’m using MySQL Workbench 8.0 CE

how to upload seed.sql file into database
can please suggest

1 Like

you dont need the old DB anymore.
just follow the instructions from Mosh.
so i.e. for the second part, you create storefront2.
afterwards you need to populate the DB with the seed-file.
just drag-drop it into this editor-thingy in MySQL Workbench.
then execute the commands. (its the lightning-symbol).

if you dont have the tables yet, you have to run the migration first.
so in VS Code (in virtual environment):

python makemigrations
python migrate

Unfortunately I’ve made a huge mess with mySQL.
So let me explain in more details.

During fixing the issue with DB, I deleted MySQL from my computer to re-install it, so I could fix it, but the things got worse.
Now when I re-install there’s an error “the path already exists” so when I go further to install, I get other errors and once it installed, I can not make any connection because getting errors.
I deleted and re-installed MySQL about five times, all the time the same issue.
So now I’ve been dealing with this issue for two days, I can’t simply install MySQL properly so I got stuck here (((

here’s the first error that I get during the installation, from this further nothing works

here are the errors that I get after incomplete installation (( i mean without any well done configurations

So afterwards i just tried to check on VS Code to connect MySQL, after inserting the password, I get the following error:

(django-store) PS D:\coding\django-store> mysql -u root -p
Enter password: ************
ERROR 2003 (HY000): Can’t connect to MySQL server on ‘localhost:3306’ (10061)
(django-store) PS D:\coding\django-store>