Windows under Install Configuration install MySQL5.7 Server free
1. Download and unpack the installation package
Download Mysql-5.7.19-winx64.zip from the official MySQL website
After the download is complete, the installation package is extracted to the D:\DevSoftware\mysql57\ directory and a mysql-5.7.19-winx64 directory is generated. Now, the MySQL directory is D:\DevSoftware\mysql57\mysql-5.7.19-winx64.
2. Create Data Catalog
Under D:\DevSoftware\mysql57\, create a data directory that is the database for the MySQL server.
3. Create a configuration file
Create a My.ini file in D:\DevSoftware\mysql57\mysql-5.7.19-winx64\, as a configuration file for MySQL.
The contents are:
[mysqld]basedir=d:/devsoftware/mysql57/mysql-5.7.19-winx64datadir=d:/devsoftware/mysql57/dataport=3306
Now the structure in the MySQL installation directory is this:
D:\DevSoftware\mysql57\
|--mysql-5.7.19-winx64\
|--data
|--mysql-5.7.19-winx64\my.ini
In this way, the MySQL software directory, data directory, and configuration files, the formation of such a structure.
4. Add the MySQL bin directory to the environment variable path
Add the D:\DevSoftware\mysql57\mysql-5.7.19-winx64\bin directory to the PATH environment variable.
5. Install the MySQL server as a Windows service
Run cmd with administrator privileges and go to the D:\DevSoftware\mysql57\mysql-5.7.19-winx64\bin directory and execute:
Mysqld--install
You can register the MySQL server as a Windows service.
D:\DEVSOFTWARE\MYSQL57\MYSQL-5.7.19-WINX64\BIN>MYSQLD--installservice successfully installed.
6. Initialize MySQL database
In cmd, go to the bin of the MySQL installation directory and execute
Mysqld--initialize--console
You can initialize the database. If the initialization process error, usually the data directory has a file, go to the data directory, delete the file, and then execute the initialization statement, you can succeed.
After initialization is complete, the initialization information will give the root user's random password, remember this password, next to the MySQL server, you need to enter this password.
D:\devsoftware\mysql57\mysql-5.7.19-winx64\bin>mysqld--initialize--console2017-08-04t10:06:35.200271z 0 [ Warning] TIMESTAMP with implicit DEFAULT value is deprecated. --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-08-04t10:0 6:36.851562Z 0 [Warning] innodb:new log files created, lsn=457902017-08-04t10:06:37.312575z 0 [Warning] innodb:creating FOREIGN KEY constraint system tables.2017-08-04t10:06:37.655489z 0 [Warning] No existing UUID have been found, so we assume That's the first time that this server has been started. Generating a new uuid:9a753507-78fc-11e7-a67d-54e1ad300ba0.2017-08-04t10:06:37.691852z 0 [Warning] Gtid table is not rea Dy to be used. Table ' mysql.gtid_executed ' cannot be opened.2017-08-04t10:06:37.713805z 1 [Note] A temporary password are generated for [E Mail protected]: Lwuw>7sxaueg
7. Start the MySQL server
Because the MySQL server is already registered as a Windows service, you can start the MySQL server by starting the Windows service.
Execute net start MySQL in cmd.
D:\devsoftware\mysql57\mysql-5.7.19-winx64\bin>net Start Mysqlmysql service is starting. The MySQL service has started successfully.
8. Log in to the MySQL server and change the root password
After you start the MySQL server, you can log on to the server. Login to the server requires the root password, root password is the initialization of the database, the system gives the random password.
After logging into the server, you cannot execute other statements, you must first modify the root user password. For specific information, see:
D:\devsoftware\mysql57\mysql-5.7.19-winx64\bin>mysql-uroot-penter Password: ************welcome to the MySQL Monitor. Commands End With; or \g.your MySQL connection ID is 4Server version:5.7.19copyright (c), and Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql> show databases; ERROR 1820 (HY000): Must reset your password using ALTER USER statement before executing this statement.mysql> set Password=password (' 123456 '); Query OK, 0 rows affected, 1 Warning (0.00 sec)
After you have modified the root password, you can perform other commands normally in MySQL. Try to see if you can execute the SQL command.
Mysql> Show databases;+--------------------+| Database |+--------------------+| information_schema | | mysql | | performance_schema | | sys |+----------- ---------+4 rows in Set (0.00 sec) mysql> CREATE database test; Query OK, 1 row Affected (0.00 sec) mysql> use test;database changedmysql> CREATE TABLE A1 (a int, b int); Query OK, 0 rows affected (0.25 sec) mysql> insert into A1 values (3, 4), (5, 6); Query OK, 3 rows affected (0.08 sec) records:3 duplicates:0 warnings:0mysql> SELECT * FROM a1;+------+------+ | A | b |+------+------+| 1 | 2 | | 3 | 4 | | 5 | 6 |+------+------+3 rows in Set (0.00 sec) mysql>
This will install the MySQL database.
Windows under Install Configuration install MySQL5.7 Server free