当前位置:网站首页>Problems encountered in connecting the database of the project and their solutions
Problems encountered in connecting the database of the project and their solutions
2022-07-06 08:50:00 【LV dajuan】
Downloaded django-vue-admin project , Want to run , But it has been stuck on the database , Solved it for two days , It must be recorded , Give me this database to see later ( Woo woo )
The first topic
1、 First, the following is the project database configuration , What is commented out here is the , I changed the database address, password and database name
- The database password here refers to the password of the database service installed locally !!! That is to say, no matter where you get the project , You have to change this password into your own database password first ( ok , Maybe only today I know sadness .jpg)
- Database name : You need to create a database locally , The name for django

Let me explain one more point before linking the database : The database connection tool I use is navicat, Then there is a relationship when creating data Database connection ----> database ------> surface
- That is, you need to create a database connection first ( You need to use the database password 、 Database user name )
- Then create a database inside the connection ( To enter the database name 、 Character set, etc. )
- Then create a data table in the database
I really don't want to say that I always thought that database connection is database name , Purring
2、 Create database connection 
Again, oh, oh, oh, oh, oh


Then double click the connection name , Connection name lights up , And you can see some initial things , Indicates that the database connection was created successfully 

3、 Create database 
Again, oh, oh, oh, oh

In this case , The database is created successfully , The following is what I created when running this project , The connection is called django, The database name is also called django
The second topic
---------- Then talk about how the data in the project can appear in the database connection tool -------
1、 First of all, you must create a database in the database connection tool ( Of course, Ning can also use commands to create ha ), See the previous topic
2、 Once you've created it , Then execute the migration command and data initialization command in the project
- python manage.py makemigrations
- python manage.py migrate
- python manage.py init
After executing these three lines of commands , Refresh the database , You can see the data table and data in the project
------ Finally, let's look at the problems encountered in this process ( It belongs to picking the wound, sobbing and hawing )-------
When I install the database , And after creating the connection , That is to say, after finishing everything mentioned in the first topic , In execution python manage.py makemigrations On this order , Report errors :
MySQLdb._exceptions.OperationalError: (1049, “Unknown database
‘django’”)

The problem : The database in the project is called django( This is the database name ), When executing this command ,django( there django It's the frame name ) Can't connect to your database , Because there is no database in your database server called django, So report this mistake .
This is because I thought the connection I created was a database , So after building the connection , Just keep executing this order , I am guilty of !
Database created ( Of course, the name is the same as that written in the project django) Then run the three commands , It's going well !!!
----- Okay , Here we go. , I also forgot other questions ....
边栏推荐
- 有效提高软件产品质量,就找第三方软件测评机构
- FairGuard游戏加固:游戏出海热潮下,游戏安全面临新挑战
- LeetCode:41. 缺失的第一个正数
- C language double pointer -- classic question type
- Purpose of computer F1-F12
- Hutool gracefully parses URL links and obtains parameters
- Chrome浏览器的crash问题
- ROS compilation calls the third-party dynamic library (xxx.so)
- vb. Net changes with the window, scales the size of the control and maintains its relative position
- How to effectively conduct automated testing?
猜你喜欢

Navicat premium create MySQL create stored procedure

LeetCode:498. 对角线遍历

LeetCode:124. 二叉树中的最大路径和

【ROS】usb_cam相机标定

Deep analysis of C language pointer

Generator parameters incoming parameters

What is CSRF (Cross Site Request Forgery)?

Cesium draw points, lines, and faces

The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower

LeetCode:236. 二叉树的最近公共祖先
随机推荐
Mobile phones and computers on the same LAN access each other, IIS settings
On the inverse order problem of 01 knapsack problem in one-dimensional state
R language ggplot2 visualization: place the title of the visualization image in the upper left corner of the image (customize Title position in top left of ggplot2 graph)
Shift Operators
超高效!Swagger-Yapi的秘密
Philosophical enlightenment from single point to distributed
Target detection - pytorch uses mobilenet series (V1, V2, V3) to build yolov4 target detection platform
What is the role of automated testing frameworks? Shanghai professional third-party software testing company Amway
R language ggplot2 visualization, custom ggplot2 visualization image legend background color of legend
UnsupportedOperationException异常
R language uses the principal function of psych package to perform principal component analysis on the specified data set. PCA performs data dimensionality reduction (input as correlation matrix), cus
FairGuard游戏加固:游戏出海热潮下,游戏安全面临新挑战
Leetcode: Sword finger offer 42 Maximum sum of continuous subarrays
C language double pointer -- classic question type
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
如何有效地进行自动化测试?
Trying to use is on a network resource that is unavailable
sublime text的编写程序时的Tab和空格缩进问题
Roguelike游戏成破解重灾区,如何破局?
JS pure function