MySQL is a very popular relational database management system at present. The installation package in the official website is available in two formats: Zip format and msi format. MSI format can be directly clicked on the installation, according to the installation prompts it gives installation, the general MySQL will be installed in the C:\Program files\mysql\mysql Server x.x (x.x is version number) of the directory; MySQL can be used after decompression, but it will be configured. I am using the zip format, so this is mainly described in the zip format of MySQL download, installation and configuration.
A Tools
WIN7 64-bit operating system
Two Steps
The first step: Download the installation package
Download Address: http://www.mysql.com/
Up to the present (2016/7/24), the latest version of the official website is 5.7.13, but I did not use the version, download the previous version of the 5.6.31.
The platform defaults to Windows.
Confirm the word length of your machine, click Download.
The second step: decompression
After decompression, the folder can be renamed and placed in the right place. I renamed the folder MySQL Server 5.6 and placed it in the D:\Program files\mysql path. Of course, you can also put yourself in any position you want to put.
Step Three: Configure (don't rush to use, preferably configure first)
After configuring the environment variable path, you can open MySQL later without switching directories. Principle: In simple terms, the environment variables inside the path, is the CMD system to find directory path. You enter an instruction, how does the system know this instruction is there? How is the system made? In fact, the system is in the current directory and system environment variable path inside the search, in order to find the first one, can not find the error. So after you set up path, you can save yourself the hassle of switching directories every time you use a command. For example: The system is like a bus, follow the established route. The path in the environment variable is the driving route. Go to a station (find the first directory) and get Off (run).
Process: Computer-> system attributes-> Advanced System configuration-> environment variables
Select path to add: your MySQL Bin folder path (for example: My is: D:\Program files\mysql\mysql Server 5.6\bin) modified path is:
Path=.;D: \program Files\mysql\mysql Server 5.6\bin (Note: 1. The semicolon must be added in English after the original path, 2. Is append, not overwrite. )
Fourth Step: Modify the configuration file
Do not start MySQL after configuring environment variables, you need to modify the configuration file, mysql-5.6.1x the default profile is in D:\Program files\mysql\mysql Server 5.6\ My-default.ini, you can create a My.ini file and modify the configuration in it:
[Mysqld] Basedir=c:\program files\mysql\mysql Server 5.6 (MySQL directory) Datadir=c:\program files\mysql\mysql Server 5.6\ Data (MySQL directory \data)
Mydefault.ini contents are as follows:
My.ini contents are as follows:
Fifth step: Install MySQL
First, run CMD as an administrator (must be run as an administrator, otherwise there will be insufficient permissions, errors)
Then, into the D:\Program files\mysql Server 5.6\bin directory,
Then, execute mysqld –install
the command, and if there is no error, the installation will be prompted to succeed.
Note: If MySQL has been installed before, but for some reason not uninstalled cleanly, when installing MySQL again, will prompt this service already exists. Use sc delete mysql command, delete previous version, then execute Mysqld–install command.
Sixth step: Start the MySQL server
Enter the command in CMD net start mysql
.
Seventh Step: Login MySQL
In cmd, input mysql -u root -p
, the first login without password, direct return, landing success.
The command to exit MySQL is exit. Directly close the cmd window is not exited, to enter exit will not exit.