MySQL installation (Windows10)

Windows 10 install MySQL

Copy and paste shortcut keys: "Ctrl+C" (copy) "Ctrl+V" (paste)

Step 1: Go to MySQL official website to download MySQL compressed package

 

Search for "MySQL" on Baidu and click on the MySQL website shown in the box in the screenshot to enter the official MySQL website

 

After entering the official website, select the "Developer Zone" shown in the box in the screenshot

 

Scroll down the page and select "MySQL Download"

 

Select "MySQL Community Server"

 

Select "Microsoft Windows"

 

Choose the first regular version to download

 

Select "Do not log in" to download

 

Note: If the browser download speed is too slow, you can use Xunlei to take over the browser download (you can also paste the web link of the download page into the Xunlei search bar, open the download page through Xunlei, and click to download)

 

Step 2: Unzip the MySQL compressed package

 

Unzip the compressed package ( please make sure that the folder path is in English and there are no spaces. It is recommended to create a new folder under D drive or C drive )

 

Right-click the folder and select Extract all

 

Click Browse and select the storage location of the decompressed folder ( Note: Please make sure that the file path is in English without spaces )

 

Step 3: Configure MySQL configuration file

Open the unzipped folder

Select "View" and check the "File Extension" option

 

Right click and select New "Text Document"

Rename the newly created text to "my.ini" Note: When renaming, delete the original suffix ".txt"

After renaming, the following prompt will appear under normal circumstances, just select "Yes"

 

Right click on the renamed "my.ini" file and select Edit

 

Paste the following text into the pop-up text box

 

[client]

# Set the default character set of mysql client

default-character-set=utf8

 

[mysqld]

# Set the port 3306

port = 3306

# Set mysql installation directory

basedir=C:\\mysql\\mysql-8.0.21-winx64

# Set the data storage directory of mysql database, MySQL 8+ does not require the configuration, the system can generate their own, or they may error

# datadir=C:\\web\\sqldata

#Maximum number of connections allowed

max_connections=20

# Server default character set used for the 8-bit coded character set latin1

character-set-server=utf8

#The default storage engine that will be used when creating a new table

default-storage-engine=INNODB

 

As shown:

Note: At this time, note that the port number is: 3306 (default) (it is needed when the graphical tool connects to the MySQL database, such as Navicat connect to MySQL)

 

The file cannot be closed at this time, please open the unzipped MySQL folder and copy its path

 

After copying it, paste it to the location shown in the "my.ini" file, and replace the original path (the part after "basedir=") (my original path is already set, so I will copy it here) It’s the same in the past, in order to avoid everyone making mistakes, copy it again)

 

The above picture is the result of pasting, and it is not over yet. Add a "\" symbol to the position where there is a "\" symbol in the path (the key of this symbol is near the keyboard enter key, directly in English mode Click the button), after adding, as shown in the figure:

Can’t find it or because of some input method, you can just copy the original symbol "\" and paste it again

 

Select "File" and click "Save"

 

Step 4: Start the MySQL database

Open cmd

Open the start menu and type cmd directly

 

Select the command prompt (open cmd)

 

Please note here that if the folder storage location after MySQL decompression is not in the C drive, please enter "the corresponding drive letter plus the colon in English mode" to switch to the corresponding directory

If the file is stored in the D drive (D drive), after opening cmd (the window above), first enter "d:" (you can also enter "D:", here is not case sensitive), and click back Car, switch to the d drive directory ( note that the colon should be entered in English mode, do not enter a Chinese colon ) Note: This method is suitable for Windows 10 system, other systems may not be suitable for this method

Results as shown below:

 

Open the unzipped MySQL file, open the bin in the file

Copy the path

 

Open the command prompt (cmd), enter "cd" ( note that there is a space after cd ) and paste the copied path, and press enter

 

Type "mysqld --initialize --console" and press Enter to initialize the database

 

A prompt pops up (do not close the command prompt (cmd) window at this time ):

 

Solution: Baidu "vc runtime library" (please ignore if there is no prompt)

Download the vc runtime library and install it (there are a lot of resources, and there are also many online tutorials. The installation here is the next step, all by default, so I won’t repeat it)

 

After the installation is complete, open the minimized command prompt window (cmd), press the up arrow key to call up the historical command "mysqld --initialize --console" and press Enter

 

At this time, please enlarge the command prompt window to facilitate copying the password generated by MySQL. Please refer to the two screenshots below for the password location

The screenshot above is to show the approximate location of the password, the screenshot below is an enlarged screenshot of the password part

 

then

Copy the password and save it

Copy the password and save it

 

Save and copy the password, very important

(The copy and paste shortcut keys have been explained at the beginning of the article), you can create a new notepad on the desktop, paste the password in and save it, or send it to yourself with QQ (search for your nickname directly in the QQ search bar) to save the password

 

Next, type "mysqld install" in the command prompt window and press Enter

At this time, the command prompt window will prompt "Install/Remove of the Service Denied!"

Don't panic, open the start menu and search for "cmd", right-click "Command Prompt" and select "Run as administrator"

 

At this time, if the storage location of the MySQL decompression file is not on the C drive, you still need to switch the directory as before (the storage location is on the C drive, please ignore) (Note: this switch directory method is suitable for win10 system, other systems may switch in different ways)

 

After completing the above operations, open the bin file under the MySQL file as before, and copy the corresponding path

 

After that is the same as before, enter "cd" in "Administrator: Command Prompt" ( there is a space after cd )

And paste the copied path after it, and press enter

Then type ""mysqld install and press enter

 

After the successful installation is displayed, enter "net start mysql" to start the MySQL service

Show that the MySQL service has been successfully started

 

Try to log in to MySQL, type "mysql -u root -p" and press enter

Prompt for password at this time

 

Copy the password you just copied and saved again (sometimes it may not be copied to cause the password to be wrong, you can copy it again patiently a few times), then open "Administrator: Command Prompt", click the right mouse button to change Paste the password in, and press enter after pasting

 

 

After that, we can change the password for the convenience of logging in

Enter "ALTER USER'root'@'localhost' IDENTIFIED BY ' 123456 ';" after logging in to MySQL

You can change the password to 123456 (If you want to change to another password, you can replace the " 123456 " in the double quotes with the password you want to change)

 

Type "exit" to exit MySQL

 

Try to log in again with the new password

Type "mysql -u root -p" and press enter

Log in to MySQL successfully, complete the installation, enter "exit" to exit and close the window with the mouse

 

Part of the information comes from:

https://www.runoob.com/mysql/mysql-install.html

https://blog.csdn.net/lxpbs8851/article/details/14161935

https://www.cnblogs.com/gkx0731/p/9739241.html

http://www.win10com.com/win10jiaocheng/12646.html

Guess you like

Origin blog.csdn.net/qq_46026718/article/details/108556760