Install mysql5.7 on Windows

Source: Internet
Author: User
Tags change settings mysql in

Preparation before installation:

System: windows7-x64

Mysql:mysql5.7.19-x64-windows Compressed Package

Installation steps:

There are two ways to install MySQL on Windows, one is to install the MySQL compression package, the other is a graphical installation, as long as the configuration of the My.ini configuration file, compressed package installation is faster and easier than graphics. This article mainly describes the installation steps of the MySQL compression pack.

First, the new database file storage directory

Unzip the MySQL compressed package mysql-5.7.19-winx64.zip to D:\mysql\ below, create a new data folder under D:\mysql\mysql-5.7.19-winx64 and store the MySQL database file. If you do not want to place the database directory under Mysql-5.7.19-winx64 data, place it anywhere, as long as you specify DataDir as the corresponding directory in the My.ini configuration.

Second, the new add configuration file My.ini

Create the My.ini configuration file below mysql-5.7.19-winx64, and the content copy will:

################### #配置文件开始 ################### # for advice in how to change settings * See # HTTP://DEV.MYSQL.COM/D oc/refman/5.7/en/server-configuration-defaults.html # * * * does not EDIT the this FILE. It's a template which'll be copied to the # * * * * default location during install, and'll be replaced if you # * * * UPG Rade to a newer version of MySQL.[Client]Default-character-set=utf8[Mysqld]  port=3306 basedir = "d:\mysql\mysql-5.7.19-winx64/" DataDir = "d:\mysql\mysql-5.7.19-winx64/data/" Tmpdir = "D:\mysql\m ysql-5.7.19-winx64/data/"socket =" D:\mysql\mysql-5.7.19-winx64/data/mysql.sock "log-error=" D:\mysql\ Mysql-5.7.19-winx64/data/mysql_error.log "#server_id = 2 #skip-locking max_connections=100 table_open_cache=256 Query  _cache_size=1m tmp_table_size=32m thread_cache_size=8 innodb_data_home_dir= "d:\mysql\mysql-5.7.19-winx64/data/" Innodb_flush_log_at_trx_commit =1 innodb_log_buffer_size=128m innodb_buffer_pool_size=128m innodb_log_file_size= 10M innodb_thread_concurrency=16 innodb-autoextend-increment=1000 join_buffer_size = 128M sort_buffer_size = 32M Read _rnd_buffer_size = 32M Max_allowed_packet = 32M explicit_defaults_for_timestamp=true sql-mode= "STRICT_TRANS_TABLES,NO _auto_create_user,no_engine_substitution "Skip-grant-tables #sql_mode =no_engine_substitution,strict_trans_tables ################### #配置文件结束 ###################

Ps:1, note the small version of the file directory to be rewritten; 2, note datadir is the database file directory, we can configure any directory.

The bold in the configuration file represents different aspects of the parameter, and most often we use [mysqld], which is the MySQL server parameter.

Third, configure environment variables

Method One: Add D:\mysql\mysql-5.7.19-winx64\bin after the system variable path, and note the following semicolon;

Method Two: Create a new environment variable mysql_home=d:\mysql\mysql-5.7.19-winx64 and add the%mysql_home%\bin to the system environment variable path.

Iv. registering MySQL as a system service for Windows

Run cmd as Administrator, switch to the MySQL bin directory, execute the Add service command: mysqld install MySQL--defaults-file= "D:\mysql\mysql-5.7.19-winx64\my.ini", Where the removal service command is: mysqld remove. There is no need to perform the Remove service command here.

V. Initialize the data directory

In the bin directory of MySQL, execute: mysqld--initialize, this step is very important;

Vi. starting MySQL database service

Startup: net start MySQL

Close: net stop MySQL

Vii. Modify the initial password of the database

1 Mysql–uroot2Mysql>show databases;3Mysql> UseMySQL;4Mysql> UpdateMysql.User SetAuthentication_string=Password'123456a?')where User='Root'  andHost= 'localhost';5Mysql>FLUSHPrivileges;6Mysql>QUIT

Eight, remote login configuration

Allows root users to log on remotely and can have access to any database

Log in to the database with Mysql-uroot-p, password enter 123456a of the previous step, authorize the operation with the following command:

1Mysql>GRANT  All Privileges  on *.*  to 'Root'@'%'Identified by '12345a?'  with GRANT OPTION;2Mysql>FLUSHPrivileges;3Mysql>Quit

Note: If you have an error during the authorization process:

ERROR 1820 (HY000): Must reset your password using ALTER USER statement before executing this statement.

This is because the seventh step set the password is too simple, does not conform to the MySQL password rules, need to re-modify the password, with the following command:

1  SET = PASSWORD ('123456a? ' ); 2  ALTER USER ' Root '@'localhost'  PASSWORD EXPIRE never; 3  privileges;

In this way, the complete installation of MySQL in the Windows system.

Install mysql5.7 on Windows

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.