The whole process is roughly divided into three steps :mysql Installation and configuration ,python Environment configuration and django transfer
Environmental Science :window10,mysql8.0,python3.8
Tried several installation methods , The rookie tutorial is better , For details, please refer to MySQL Novice tutorial
See website https://www.runoob.com/mysql/mysql-install.html
Windows Installation on MySQL It will be relatively simple , The latest version can be found in MySQL download Download and view
Click on Download Button to go to the download page , Click No thanks, just start my download. You can download it immediately :
After downloading , We will zip Extract the package to the corresponding directory , Here I put the unzipped folder in C:\program\mysql Next .
Open the folder you just unzipped C:\program\mysql , Create... Under this folder my.ini The configuration file , edit my.ini Configure the following basic information ( Be careful : You need to change the code basedir= Installation directory after ):
[client]
# Set up mysql Client default character set
default-character-set=utf8
[mysqld]
# Set up 3306 port
port = 3306
# Set up mysql Installation directory
basedir=C:\\program\\mysql
# Maximum connections allowed
max_connections=20
# The character set used by the server defaults to 8 Bit coded latin1 Character set
character-set-server=utf8
# The default storage engine that will be used when creating a new table
default-storage-engine=INNODB
At the command prompt CMD in cd Into the C:\program\mysql\bin
Initialize database :
mysqld --initialize --console
After execution , Will be output root User's initial default password , Such as :
...
2018-04-20T02:35:05.464644Z 5 [Note] [MY-010454] [Server] A temporary password is generated for [email protected]: APWCY5ws&hjQ
...
APWCY5ws&hjQ It's the initial password , Just remember . Subsequent login needs to use , You can change your password after logging in .
Enter the following installation commands :
mysqld install
Start and input the following command :
net start mysql
Sign in MySQL root user :
mysql -u root -p
stay enter passwor: Then enter the initial password just generated
The previous step has entered mysql Command line .
You can choose to modify root User password is root, stay mysql> Post input :
set password for [email protected] = password('root');
https://www.cnblogs.com/opsprobe/p/9126864.html
https://blog.csdn.net/weixx3/article/details/80782479
Enter into the relevant python Environmental Science , direct pip Just install the required package .
My virtual environment , stay pycharm Directly prompt to create virtual environment and install related packages
stay CMD in cd Enter the project directory , This directory has a manage.py file , Execute... In the directory
python manage.py migrate
If the relevant package is missing , Will report a mistake .pip Install well
A database error will also be reported , This is because it was built before mysql There is no our database
stay CMD Input in :mysql -u root -p And the root Password entry mysql establish
create database db_eye character set utf8
When everything is configured , Again django Enter again in the directory
python manage.py migrate
If successful, the following interface will be displayed , It means success
python manage.py createsuperuser
Set login user and password