This article explains installing MySQL from a compressed package.
1. Download the MySQL compression pack, "Windows (x86, 64-bit), ZIP Archive";
2. Unzip the zip package to the desired directory, such as D:\mysql-5.7.18-winx64;
3. Create the My.ini file with the following content:
[mysqld] port=3306 basedir=d:\\mysql-5.7. -winx64\datadir=f:\\mysqldata\\
Character-set-server=utf8
Note that Basedir and DataDir are required to be configured, and Basedir is the directory you unzipped. The official document says that if you like to use a slash, you use a double slash, and you don't have to do that with a backslash. i.e.: d:\\mysql-5.7.13-winx64\\ or: d:/mysql-5.7.13-winx64/
Because I like to separate the data files of the database, so the DataDir configuration to other places, easy to manage.
4. Configure Environment variables
Add a variable called Mysql_home.
Modify the path variable and add%mysql_home%\bin at the end
5. Initializing and starting the MySQL service
Run cmd with administrator privileges, initialize MySQL, execute
-- initialize-insecure
Register MySQL service, start MySQL, execute
- installnet start MySQL
6. Log in to MySQL and set the root password
- -P
First login without password direct enter login, log in MySQL, set the root password
ALTER USER ' Root '@ 'localhost'by'mynewpass4! ';
After changing the password, we can log in successfully using root.
MySQL5.7 installation under Windows