# Can't connect DB created by MySQL to Django project

**URL:** <https://forum.codewithmosh.com/t/cant-connect-db-created-by-mysql-to-django-project/19856>\
**Category:** Django\
**Created:** [April 25, 2023, 11:01pm UTC](https://forum.codewithmosh.com/t/cant-connect-db-created-by-mysql-to-django-project/19856 "2023-04-25T23:01:42Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![orazbek](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/orazbek/32/5448_2.png) [@orazbek](https://forum.codewithmosh.com/u/orazbek)\
**Post date:** [April 25, 2023, 11:01pm UTC](https://forum.codewithmosh.com/t/cant-connect-db-created-by-mysql-to-django-project/19856/1 "2023-04-25T23:01:42Z")

</div>

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’”)  
warnings.warn(

---

<div class="post-metadata">

**Author:** ![blitzoc](https://avatars.discourse-cdn.com/v4/letter/b/6bbea6/32.png) [@blitzoc](https://forum.codewithmosh.com/u/blitzoc)\
**Post date:** [April 26, 2023, 2:41pm UTC](https://forum.codewithmosh.com/t/cant-connect-db-created-by-mysql-to-django-project/19856/2 "2023-04-26T14:41:00Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![orazbek](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/orazbek/32/5448_2.png) [@orazbek](https://forum.codewithmosh.com/u/orazbek)\
**Post date:** [April 26, 2023, 8:53pm UTC](https://forum.codewithmosh.com/t/cant-connect-db-created-by-mysql-to-django-project/19856/3 "2023-04-26T20:53:34Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![orazbek](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/orazbek/32/5448_2.png) [@orazbek](https://forum.codewithmosh.com/u/orazbek)\
**Post date:** [April 27, 2023, 9:20pm UTC](https://forum.codewithmosh.com/t/cant-connect-db-created-by-mysql-to-django-project/19856/4 "2023-04-27T21:20:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sravanthi](https://avatars.discourse-cdn.com/v4/letter/s/e79b87/32.png) [@sravanthi](https://forum.codewithmosh.com/u/sravanthi)\
**Post date:** [April 28, 2023, 3:05am UTC](https://forum.codewithmosh.com/t/cant-connect-db-created-by-mysql-to-django-project/19856/5 "2023-04-28T03:05:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![blitzoc](https://avatars.discourse-cdn.com/v4/letter/b/6bbea6/32.png) [@blitzoc](https://forum.codewithmosh.com/u/blitzoc)\
**Post date:** [April 28, 2023, 8:38pm UTC](https://forum.codewithmosh.com/t/cant-connect-db-created-by-mysql-to-django-project/19856/6 "2023-04-28T20:38:56Z")

</div>

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):

```auto
python manage.py makemigrations
python manage.py migrate

```

---

<div class="post-metadata">

**Author:** ![orazbek](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/orazbek/32/5448_2.png) [@orazbek](https://forum.codewithmosh.com/u/orazbek)\
**Post date:** [April 28, 2023, 9:49pm UTC](https://forum.codewithmosh.com/t/cant-connect-db-created-by-mysql-to-django-project/19856/7 "2023-04-28T21:49:32Z")

</div>

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 (((

---

<div class="post-metadata">

**Author:** ![orazbek](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/orazbek/32/5448_2.png) [@orazbek](https://forum.codewithmosh.com/u/orazbek)\
**Post date:** [April 28, 2023, 9:59pm UTC](https://forum.codewithmosh.com/t/cant-connect-db-created-by-mysql-to-django-project/19856/8 "2023-04-28T21:59:18Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/0/0b36fce45e66f406b1b4134bd0f9624e2a2e6ad3.png)

---

<div class="post-metadata">

**Author:** ![orazbek](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/orazbek/32/5448_2.png) [@orazbek](https://forum.codewithmosh.com/u/orazbek)\
**Post date:** [April 28, 2023, 10:27pm UTC](https://forum.codewithmosh.com/t/cant-connect-db-created-by-mysql-to-django-project/19856/9 "2023-04-28T22:27:42Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/e/e1fc047791c8697bf9df3853cf3e3116512be0e0.png)  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/b/bb46a75a38f6ab96619a3f574957d712d986615d.png)  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/2/20a03b93c0362c0e489b56564e3716e071ade298.png)

---

<div class="post-metadata">

**Author:** ![orazbek](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/orazbek/32/5448_2.png) [@orazbek](https://forum.codewithmosh.com/u/orazbek)\
**Post date:** [April 28, 2023, 10:31pm UTC](https://forum.codewithmosh.com/t/cant-connect-db-created-by-mysql-to-django-project/19856/10 "2023-04-28T22:31:18Z")

</div>

![Снимок экрана 2023-04-29 002832](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/2/29d25b98b4a319a4e312e187cef8d3f2af8008d5.png)

 ![image](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/3/3d3bfe42ab01900374308b229c96aa5c4516a313.png)

---

<div class="post-metadata">

**Author:** ![orazbek](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/orazbek/32/5448_2.png) [@orazbek](https://forum.codewithmosh.com/u/orazbek)\
**Post date:** [April 28, 2023, 10:37pm UTC](https://forum.codewithmosh.com/t/cant-connect-db-created-by-mysql-to-django-project/19856/11 "2023-04-28T22:37:32Z")

</div>

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\>
