1. Download the mysql5.7 free installation package from the official website http://dev.mysql.com/downloads/mysql/
2. After decompression, add the my.ini configuration file in the decompression root directory
##############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[client]
default-character-set=utf8
[mysqld]
skip-grant-tables #Skip permissions, allowing root users to log in with an initial empty password
port=3306
basedir ="D:\mysql\mysql-5.7.12-winx64/"
datadir ="D:\mysql\mysql-5.7.12-winx64/data/"
tmpdir ="D:\mysql\mysql-5.7.12-winx64/data/"
socket ="D:\mysql\mysql-5.7.12-winx64/data/mysql.sock"
log-error="D:\mysql\mysql-5.7.12-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.12-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"
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
####################Config file end ###################
3. In %mysql%/bin Run cmd.exe in the directory
Execute mysqld --initialize to initialize mysql, and data and mysql subdirectories will be generated in the %mysql% directory
4. Execute mysqld install MySQL --defaults-file="D:\mysql\mysql-5.7.12-winx64\my.ini" for service installation
mysqld remove is to remove the service
5. Execute net start mysql to start the mysql service net stop mysql is to stop the service
6. Add the %mysql%/bin directory to the environment variable
7. Modify the root password
Command line execution: mysql –uroot -p
Enter empty password
mysql> SET PASSWORD = PASSWORD(‘123456‘);
mysql> ALTER USER ‘root‘@‘localhost‘ PASSWORD EXPIRE NEVER;
mysql> flush privileges;
mysql> QUIT
8. Remote login configuration
Allow the root user to log in remotely from anywhere and have any operation permissions for all libraries. The specific operations are as follows:
1) Log in to mysql using the root user on this machine:
Command line execution: mysql -u root -p
Enter the password (the one set in step 7): 123456
2) Perform an authorization operation:
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
Reload the authorization table:
mysql>FLUSH PRIVILEGES;
quit mysql: quit