当前位置:网站首页>MySQL download, installation and use - complete and detailed steps

MySQL download, installation and use - complete and detailed steps

2022-06-11 10:44:00 weixin_ thirty-nine million four hundred and fifty thousand one

Catalog

One 、 install MySQL

1. download MySQL Compressed package  

2. install mysql

3. create profile

4. initialization

Two 、 start-up MySQL

1. Production services :....--install mysql

2. start-up mysql:net start mysql

3. close mysql:net stop mysql

4. You can see in the service mysql This service

3、 ... and 、 Connect the test

1.  take mysql The installation directory ”D:\Program Files\mysql-5.7.31-winx64\bin\“ Add to system environment variable .

2.  start-up mysql service :

3. At this time, you don't need administrator permission , Open it directly cmd, Input mysql -u root -p:

4. Enter for the first time , Remember to give mysql Set a password :

5. Check the existing database

6. sign out ( Close the connection )

7. Connect again MySQL( You need to enter a password )

8. Summary command

notes : If you want to delete mysql service , Reinstall mysql service , You can refer to the following steps :


One 、 install MySQL

1. download MySQL Compressed package  

Download address :MySQL :: Download MySQL Community Server (Archived Versions)

Download here is MySQL Of 5.7.31 edition ,windows,64 position .

Downloaded zip Compressed package :

2. install mysql

mysql-5.3.71-winx64.zip Is an installation free version .

  • decompression zip file
  • Put the unzipped compressed package file into the path ( Don't have a Chinese path )( I put it here D:\Program Files Next )

3. create profile

stay mysql Installation directory , Create a my.ini The configuration file , Then add the following to it (mysql The installation directory should be changed to its own ):

### my.ini

[mysqld]
 basedir = "D:\Program Files\mysql-5.7.31-winx64"    #mysql The installation directory 
 datadir = "D:\Program Files\mysql-5.7.31-winx64\data" #mysql The installation directory +data
 port=3306
 character-set-server=utf8
 character_set_filesystem= binary

 [client]
 port=3306
 default-character-set = utf8

 [mysqld_safe]
 timezone="CST"

 [mysql]
 default-character-set=utf8

4. initialization

  • Open the terminal & Run as Administrator :

  • Input the initialization command at the terminal , Meeting Generate a to root Username , User data with empty password :( In the double quotation marks before the command is :mysql Installation directory )

"D:\Program Files\mysql-5.7.31-winx64\bin\mysqld.exe" --initialize-insecure

#  Their own mysql The installation directory  +  --initialize-insecure

  •   After successful command execution ,mysql A new one will be added to the directory data Catalog :

  thus ,MySQL Installation is complete .

Two 、 start-up MySQL

1. Production services :....--install mysql

"D:\Program Files\mysql-5.7.31-winx64\bin\mysqld.exe" --install mysql

2. start-up mysql:net start mysql

3. close mysql:net stop mysql

4. You can see in the service mysql This service

then win+R, Input services.msc, You can see in the service mysql This service : 

3、 ... and 、 Connect the test

1.  take mysql The installation directory ”D:\Program Files\mysql-5.7.31-winx64\bin\“ Add to system environment variable .

Right click on my computer ——> attribute ——> Advanced system setup ——> environment variable ——> In the system variable “Path”——> spot “ edit ”——>” newly build “——> take ”D:\Program Files\mysql-5.7.31-winx64\bin\“ Add to system environment variable ——>” determine “.

2.  start-up mysql service :

 

3. At this time, you don't need administrator permission , Open it directly cmd, Input mysql -u root -p:

No password by default , Just click enter , Last appearance "mysql>" It's a success .

4. Enter for the first time , Remember to give mysql Set a password :

( Next time you enter mysql Directly enter the set password )

set password = password('root123');  # Set the password to root123

5. Check the existing database

Input :show databases;

6. sign out ( Close the connection )

Input :exit;

7. Connect again MySQL( You need to enter a password )

8. Summary command

C:\Users\dell>mysql -u root -p               # stay cmd Terminal input command , Get into mysql
mysql> set password = password('root123');   # Enter for the first time mysql after , Set the password 
mysql> show databases;                       # Display database 
mysql> exit;                                 # sign out 

C:\Users\dell>mysql -u root -p  # stay cmd Terminal input command , Once again into the mysql
 Input password                          # At this time , Entry required mysql Password 
mysql> exit;                    # sign out 

notes : If you want to delete mysql service , Reinstall mysql service , You can refer to the following steps :

# The specific orders are as follows :

 Enter as Administrator cmd:
C:\WINDOWS\system32>"D:\Program Files\mysql-5.7.31-winx64\bin\mysqld.exe" --remove mysql     # Delete mysql service 
 Delete D:\Program Files\mysql-5.7.31-winx64 Install under directory data file 
C:\WINDOWS\system32>"D:\Program Files\mysql-5.7.31-winx64\bin\mysqld.exe" --initialize-insecure # Reinitialize 
C:\WINDOWS\system32>"D:\Program Files\mysql-5.7.31-winx64\bin\mysqld.exe" --install mysql       # reinstall mysql service 
C:\WINDOWS\system32>net start mysql  # start-up mysql service 
C:\WINDOWS\system32>mysql -u root -p # Get into mysql
Enter password:                      # Enter for the first time , No password , Directly by enter that will do 
mysql> set password = password('root123'); # Enter for the first time , Set a password to root123
mysql> show databases;                     # Display the original database 
mysql> exit;                               # sign out mysql
C:\WINDOWS\system32>net stop mysql         # stop it mysql service 

Reference resources :

newest Python Of web Develop a family bucket (django+ front end + database )_ Bili, Bili _bilibili 26-MySQL- Step by step

How to solve the problem of mysql After the service starts and stops , Some services stop automatically when they are not used by other services or programs _ Lajojojomu's blog -CSDN Blog

原网站

版权声明
本文为[weixin_ thirty-nine million four hundred and fifty thousand one]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206111032168810.html