1, Mysql-5.7.13-winx64.zip download
Official: http://dev.mysql.com/downloads/mysql/
2. Unzip to D:\mysql\mysql-5.7.13-winx64
3. Create a new My.ini configuration file under D:\mysql\mysql-5.7.13-winx64
The contents are as follows:
?
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 6667686970717273747576777879808182838485 |
####################配置文件开始###################
#
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]
port=3306
basedir =
"D:\mysql\mysql-5.7.13-winx64/"
datadir =
"D:\mysql\mysql-5.7.13-winx64/data/"
tmpdir =
"D:\mysql\mysql-5.7.13-winx64/data/"
socket =
"D:\mysql\mysql-5.7.13-winx64/data/mysql.sock"
log-error=
"D:\mysql\mysql-5.7.13-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.13-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 ####################配置文件结束###################
|
The focus is the following configuration, where the directory name of DataDir must be: d:\mysql\mysql-5.7.13-winx64/data/, plus skip-grant-tables, so that Root does not lose the password, login
4. In the Windows System environment variable path, add the following:
D:\mysql\mysql-5.7.13-winx64\bin; (note plus semicolon)
5. Registering MySQL as a Windows system service
To do this, execute the following command on the command line (you need to run the command line as an administrator):
CD C:\Windows\System32
Run as Administrator cmd.exe
You need to switch to the bin directory, otherwise the service directory will be specified as D:\mysql\mysql-5.7.13-winx64\bin
Add Service command: mysqld install MySQL--defaults-file= "D:\mysql\mysql-5.7.13-winx64\my.ini"
The Removal Service command is: mysqld remove
6. After the 5th step succeeds, initialize the data directory
D:\mysql\mysql-5.7.13-winx64\bin>mysqld--initialize
This step is important, uninitialized, and may cause the MySQL service to fail to start (pit one)
7. Open System Services Management
You can see the MySQL system service
Start MySQL command at the command line for: net start MySQL
Shutdown mysql command for: net stop MySQL
8. Change the root password
Command line execution:
?
123456789101112 |
mysql –uroot
mysql>show databases;
mysql>use mysql;
mysql>
update mysql.
user set authentication_string=
password
(
‘123456‘
)
where user
=
‘root‘ and Host =
‘localhost‘
;
mysql> FLUSH
PRIVILEGES
;
mysql> QUIT
|
9. Remote Login Configuration
Allow the root user to remotely log in anywhere and have any permissions to operate on any library, as follows:
1) Log in to MySQL first using the root user:
Command line execution: Mysql-u root-p
Enter password (password set in step 7th): 12345
2) Authorize the operation:
Mysql>grant all privileges on * * to ' root ' @ '% ' identified by ' 12345 ' with GRANT OPTION;
Overload Authorization Table:
Mysql>flush privileges;
Exit Mysql:quit
Windows installation Configuration Mysql-5.7.13-winx64 method