One, MySQL free installation version of the installation: 1, MySQL is divided into two versions:
Install the MSI format file of the board, click Next directly, then you can install
Free installation version of the ZIP format, directly decompression configuration installation, "Decompression-initialize the creation of the data directory-Create user-Create service-start"
2, free installation version-installation steps:
(1) Download MySQL version: "https://dev.mysql.com/downloads/mysql/"
(2) Extract the compressed package to the specified installation directory: "D:\mysql-5.7.21"
(3) Create a new "My.ini" file in the installation directory, open the edit, copy the content below
[mysql]# set MySQL client default character set Default-character-set=utf8[mysqld] #设置3306端口port = 3306# Set the installation directory for MySQL Basedir=d:\ mysql-5.7.21# set the data storage directory for the MySQL database datadir=d:\mysql-5.7.21\data# the maximum number of connections allowed max_connections=200# The character set used by the service side defaults to a 8-bit encoded latin1 character Set character-set-server=utf8# open the query cache explicit_defaults_for_timestamp= trueskip-grant-tables# The default storage engine that will be used when creating a new table Default-storage-engine=innodb
(4) Configure environment variables:
"Mysql_home:d:\mysql-5.7.21-winx64"
Add ";%mysql_home%\bin" after the system environment path, not Win10 's small partner to notice the semicolon (";")
(5) Initializing MySQL
Run "cmd.exe" as Administrator
Run the command: "mysqld--initialize--user=mysql--console", run successfully, the end of the last line will have "root initialization password, please remember!!!" 】
(6) Installation Services:
Run the command "Mysqld--install mysql3306", after successful execution, the service will be more than a "mysql3306" service
(7) Start or stop the service:
Run the command "net start mysql3306" "net stop mysql3307"
(8) Precautions:
A, when specifying an environment variable, path is assigned to a system variable, "specified as a user variable may cause initialization command execution to fail"
B, the old version of MySQL has "my.cnf" file, in the "Mysql-5.7.21-winx64.zip" This version is not, need to create a new "My.ini" file
C, change the password command: login to MySQL after executing "set password for [email protected]=password (' your password ');"
D, reference article: "http://blog.csdn.net/darling_for/article/details/79070353"
Second, MySQL multi-instance installation steps: "Copy-Modify configuration file-new service-Modify the Registry"
(1) Copy the MySQL installation directory to the specified location, delete the "data" folder in addition to MySQL, test other files, folders
(2) Modify the port, installation directory, data directory in "My.ini"
(3) Install new service: Run command "mysqld--install mysql3309"
(4) Modify the registry file:
Registry file location: "hkey_local_machine\system\currentcontrolset\services\mysql_3307"
The value for modifying "ImagePath" is: "" D:\MySql_3309\bin\mysqld "--defaults-file=" D:\MySql_3309\my.ini "mysql3309"
(5) normal start-up service: Reference article "https://www.cnblogs.com/jpfss/p/8143641.html"
(6) Note:
A, multi-instance installation does not need to execute the MySQL initialization command again
B, the copied instance, the root password of MySQL and the same command that you used when you initially installed it
C, the command to delete the service: "SC delete mysql3309"
D, after entering cmd, and then log in to MySQL, when executing the command line, the sentence must end with a semicolon, the command to execute
E, do not modify the registry, open Multiple services point to the same instance
F, eliminating the initial operation after installation, directly delete the files in the data directory can be
Third, follow-up:
Installation time has a lot of problems, the installation is not successful, the file cannot be found, the service starts to stop, most of the initialization operation is caused by failure
The Data folder is not created manually, it is created with the init command, otherwise the folder is not empty and the initialization fails.
Be sure to run CMD as an administrator, or initialize MySQL and error when initializing the user
This article applies to installation:
win10-x64 free installation Version "Mysql-5.7.21-winx64.zip" when used, other versions for reference only
Don't be discouraged, try a few more times, don't be afraid of trouble, adhere to will find a way!!!