Windows10 download & install MySql5.7.29 database

1. Download MySql
https://www.mysql.com/

1. After entering the official website, scroll down to the bottom of the page and click "MySQL Community Server"
Insert image description here
2. I downloaded MSI, so I clicked "< MySQL Community Server"
Insert image description here
3. Click on the one selected in the red box
Insert image description here
4. Continue to click on the red box to select 5.
Insert image description here
I downloaded MySQL MSI 5.7 64-bit version
Insert image description here
6. Select the red box
Insert image description here
2. Install Mysql
1. Double-click the installation package
2. I chose custom installation

Because there are many things that we (novices) do not need, there is no need to install them.
Insert image description here
3. Choose what you need to install.
Insert image description here
4. Change the installation directory
Insert image description here
Insert image description here
5. Click "Execute"
Insert image description here
6. Next, next, next
Insert image description here
7. Click next
Insert image description here
8. Set the root account password
Insert image description here
9. Click next
Insert image description here
10. Click Execute
Insert image description here
11. Click next
Insert image description here
12. Finish
13. Open "Start Menu"
Insert image description here
14. Enter the password
(test whether mysql is configured successfully: open cmd, enter "mysql -u root -p" and press Enter, then enter the password of the root account set during mysql installation (Dw.2016%), if The prompt "Welcome to the MySQL monitor." indicates that the configuration is successful). If you enter mysql in the console (cmd) window of the computer and it prompts: It is not an internal or external command or a runnable program, you need to configure the mysql environment variable. .
Insert image description here
3. Environment configuration
1. Add a system variable, click New, the variable is named: MYSQL_HOME, the variable value is: mysql installation directory
description: After configuring the environment variable for mysql, we can run mysql in cmd (start, stop, etc.) )
Insert image description here
2. In the system variables, click "Path", create a new one, enter: %MYSQL_HOME%\bin
Insert image description here

3. Select "path" in the system variable, enter the path to the bin folder in the mysql installation directory at the beginning of the path value: C:\Program Files\MySQL\MySQL Server 5.7\bin, save and exit 4. Verify that cmd
Insert image description here
enters
win Terminal, enter: mysql -Version
Insert image description here
This is it! success!
1. Possible errors
mysql -Version, V needs to be capitalized.
"'mysql' is not recognized as an internal or external command, operable program
or batch file." Environment variables do not take effect. Run cmd as administrator, or restart, otherwise the environment variables are misconfigured.
****5. Some MySql commands

  1. Start the mysql service
    Note: mysql57, the name during installation. That is "window service name". If you have forgotten it, see "2. Step 9 of installing Mysql"
    net start mysql57
  2. Stop mysql service
    net stop mysql57
  3. Check the version of mysql
    mysql -Version
  4. Log in to mysql
    mysql -u'username' -p'password'****
    Insert image description here
  5. View the MySQL installation directory (you need to log in to mysql first)
    show variables like “%char%”; 6. View the physical file storage location of the mysql database (you need to log in to mysql first)
    show global variables like “%datadir%”;
  6. Check the character set of mysql (you need to log in to mysql first)
    show variables like '%char%';
  7. Modify the character set of mysql (you need to log in to mysql first)
    set character_set_connection=utf8;
  8. MySQL exit
    1.\exit
    2.\quit

, Start mysql
Yes, we have not started our mysql yet! So how to start it?
(Based on the situation where environment variables have been configured)
Insert image description here
2. After prompting that the startup is successful, we can see the "mysqld.exe" process in the process of the task manager.
Attachment:
If when executing the command, it prompts: The service name is invalid. Please type NET HELPMSG 2185 for more help.
Solution: Execute the mysqld -install command with administrator privileges in the mysql bin directory

Attachment: How to uninstall the mysql service.
1. Use the administrator authority net stop mysql to close the mysql service.
2. Use the administrator authority mysqld -remove to uninstall the mysql service.
Close and start the mysql database command
net stop mysql to close the database
net start mysql to start the database.

Guess you like

Origin blog.csdn.net/weixin_46605889/article/details/115247782