As of 2016/10/16 the latest version of MySQL is 5.7.16, before writing an article APMW built (Portal: http://www.cnblogs.com/airoot/p/4131906.html) The installation of the MySQL method section is not suitable for the new version. So I reopened the post.
MySQL Community version download address: http://dev.mysql.com/downloads/mysql/
Because my system version is 64, I download the x64 version here. After downloading, extract to D:\Dev\Mysql (that is, the custom extract directory for Mysql.) )
My habit is to register the system service first after downloading. CMD opens the command prompt, enters under D:\Dev\Mysql\bin, installs the Mysql as the service:
Mysqld.exe-install "ServiceName" (do not start the service after the installation is complete, because it will complain)
Adding environment variables
The operation is as follows:
① Right-click My Computer-> Properties-> advanced system settings (Advanced)-> environment variables
Click the New button under the system variable
Input variable name: mysql_home
Input variable Value: D:\Dev\Mysql
② Select the path in the system variable and click the Edit button
Add a variable value to a variable value:%mysql_home%\bin (note that you want to use it after the original variable value; Separated, cannot delete original variable value)
Configuring Mysql.ini Files
Copy the My-default.ini file in the D:\Dev\Mysql root directory to My.ini, replacing the content with the following configuration
[MySQL]
# set MySQL client default character set
Default-character-set=utf8
[mysqld]
#设置3306端口
port = 3306
# set MySQL installation directory
Basedir=d:\dev\mysql
# Set up the MySQL database data storage directory
datadir=d:\dev\mysql\data
# Allow maximum number of connections
Max_ connections=200
# Server uses a character set that defaults to a 8-bit encoded latin1 character set
Character-set-server=utf8
# The default storage engine
to use when creating a new table Default-storage-engine=innodb
Initializing MySQL
This is also the biggest difference from previous versions: Starting with 5.7.7, the installation package under Windows does not contain the data directory, which requires initialization before starting the service:
Open cmd as Administrator and enter mysqld--initialize-insecure--user=mysql
After executing this command, MySQL will build a data folder in the root directory, and build the default database, login username root, password is empty
Re-enter net start MySQL start service, OK start successfully
Login to MySQL Database
Enter Mysql-u Root-p, the default is no password. Direct return entry, root is user name
Use show databases at this time; You can already see the default database for initializing the build.
Modify root account password
After connecting to the MySQL database, use the command to modify the password
Set Password=password (' 123456 ');
Flush privileges;
Sign out again and use the new password:
Mysql-u root-p 123456
Note: After mysql5.6 (as if after 5.6, specifically remember), in the Mysql.user table no longer appear password field, so use Update user set Password=password ("XXX") is no longer feasible, You can only modify the password using ALTER user ' user ' @ ' localhost ' identified by ' 123456 '
Wonderful topic sharing: MySQL different version installation tutorials, mysql5.7 versions of the installation tutorials
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.