windows-mysql-5.7.13 zip安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了windows-mysql-5.7.13 zip安装相关的知识,希望对你有一定的参考价值。
一、安装步骤
1、环境介绍
安装机器:window7 64bit 8G内存
mysql版本:mysql-5.7.13-winx64.zip
2、下载
3、解压
解压到:D:\\work\\mysql
4、修改配置文件
1. 复制my-default.ini
2. 修改my-default.ini 为my.ini
3. 修改内容:
[mysql]
default-character-set=utf8
[mysqld]
server_id = 1
basedir = D:\\work\\mysql
datadir = D:\\work\\data
port = 3306
#log
log-bin
log-error = D:\\work\\log\\error.log //应使用默认的位置log-error = error.log ,不然net start mysql 不能启动
slow_query_log_file = D:\\work\\log\\slow.log
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
20
1
[mysql]
2
default-character-set=utf8
3
4
[mysqld]
5
server_id = 1
6
basedir = D:\\work\\mysql
7
datadir = D:\\work\\data
8
port = 3306
9
10
11
#log
12
log-bin
13
log-error = D:\\work\\log\\error.log //应使用默认的位置log-error = error.log ,不然net start mysql 不能启动
14
slow_query_log_file = D:\\work\\log\\slow.log
15
16
# join_buffer_size = 128M
17
# sort_buffer_size = 2M
18
# read_rnd_buffer_size = 2M
19
20
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
5、初始化数据库
PS: shift+空白处右键,可召唤cmd。注意需要管理员cmd
win+R 打开运行,输入cmd,召唤cmd窗口
C:\\Users\\aijie>D:
D:\\>cd work
D:\\work>cd mysql\\bin
D:\\work\\mysql\\bin>mysqld --initialize-insecure --console
2017-09-04T07:17:16.798688Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-09-04T07:17:16.798688Z 0 [Warning] ‘NO_ZERO_DATE‘, ‘NO_ZERO_IN_DATE‘ and ‘ERROR_FOR_DIVISION_BY_ZERO‘ sql modes should be used with strict mode. They will be merged with strict mode in a future r
elease.
2017-09-04T07:17:16.798688Z 0 [Warning] ‘NO_AUTO_CREATE_USER‘ sql mode was not set.
2017-09-04T07:17:16.802688Z 0 [Warning] No argument was provided to --log-bin, and --log-bin-index was not used; so replication may break when this MySQL server acts as a master and has his hostname c
hanged!! Please use ‘--log-bin=YHDZJ-NB2031867-bin‘ to avoid this problem.
2017-09-04T07:17:17.256688Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-09-04T07:17:17.342688Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-09-04T07:17:17.438688Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 154d78b0-9141-11e7-a426-00ff
813dc000.
2017-09-04T07:17:17.449688Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed‘ cannot be opened.
2017-09-04T07:17:17.454688Z 1 [Warning] [email protected] is created with an empty password ! Please consider switching off the --initialize-insecure option.
20
1
win+R 打开运行,输入cmd,召唤cmd窗口
2
C:\\Users\\aijie>D:
3
4
D:\\>cd work
5
6
D:\\work>cd mysql\\bin
7
8
D:\\work\\mysql\\bin>mysqld --initialize-insecure --console
9
2017-09-04T07:17:16.798688Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
10
2017-09-04T07:17:16.798688Z 0 [Warning] ‘NO_ZERO_DATE‘, ‘NO_ZERO_IN_DATE‘ and ‘ERROR_FOR_DIVISION_BY_ZERO‘ sql modes should be used with strict mode. They will be merged with strict mode in a future r
11
elease.
12
2017-09-04T07:17:16.798688Z 0 [Warning] ‘NO_AUTO_CREATE_USER‘ sql mode was not set.
13
2017-09-04T07:17:16.802688Z 0 [Warning] No argument was provided to --log-bin, and --log-bin-index was not used; so replication may break when this MySQL server acts as a master and has his hostname c
14
hanged!! Please use ‘--log-bin=YHDZJ-NB2031867-bin‘ to avoid this problem.
15
2017-09-04T07:17:17.256688Z 0 [Warning] InnoDB: New log files created, LSN=45790
16
2017-09-04T07:17:17.342688Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
17
2017-09-04T07:17:17.438688Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 154d78b0-9141-11e7-a426-00ff
18
813dc000.
19
2017-09-04T07:17:17.449688Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed‘ cannot be opened.
20
2017-09-04T07:17:17.454688Z 1 [Warning] [email protected] is created with an empty password ! Please consider switching off the --initialize-insecure option.
6、启动和关闭
D:\\work\\mysql\\bin>start /b mysqld --console -- 后台启动数据库
D:\\work\\mysql\\bin>2017-09-04T08:06:16.728540Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more de
tails).
2017-09-04T08:06:16.728540Z 0 [Warning] ‘NO_ZERO_DATE‘, ‘NO_ZERO_IN_DATE‘ and ‘ERROR_FOR_DIVISION_BY_ZERO‘ sql modes should be used with strict mode. They will be merged with strict mode in a future r
elease.
2017-09-04T08:06:16.728540Z 0 [Warning] ‘NO_AUTO_CREATE_USER‘ sql mode was not set.
2017-09-04T08:06:16.728540Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2017-09-04T08:06:16.729539Z 0 [Note] mysqld (mysqld 5.7.13-log) starting as process 7356 ...
2017-09-04T08:06:16.735538Z 0 [Warning] No argument was provided to --log-bin, and --log-bin-index was not used; so replication may break when this MySQL server acts as a master and has his hostname c
hanged!! Please use ‘--log-bin=YHDZJ-NB2031867-bin‘ to avoid this problem.
2017-09-04T08:06:16.745536Z 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2017-09-04T08:06:16.746536Z 0 [Note] InnoDB: Uses event mutexes
2017-09-04T08:06:16.746536Z 0 [Note] InnoDB: _mm_lfence() and _mm_sfence() are used for memory barrier
2017-09-04T08:06:16.753535Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-09-04T08:06:16.759533Z 0 [Note] InnoDB: Number of pools: 1
2017-09-04T08:06:16.765532Z 0 [Note] InnoDB: Not using CPU crc32 instructions
2017-09-04T08:06:16.782529Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2017-09-04T08:06:16.796526Z 0 [Note] InnoDB: Completed initialization of buffer pool
2017-09-04T08:06:16.834518Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2017-09-04T08:06:16.881509Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2017-09-04T08:06:16.882509Z 0 [Note] InnoDB: Setting file ‘.\\ibtmp1‘ size to 12 MB. Physically writing the file full; Please wait ...
2017-09-04T08:06:16.925500Z 0 [Note] InnoDB: File ‘.\\ibtmp1‘ size is now 12 MB.
2017-09-04T08:06:16.943497Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2017-09-04T08:06:16.945496Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2017-09-04T08:06:16.948496Z 0 [Note] InnoDB: Waiting for purge to start
2017-09-04T08:06:17.003485Z 0 [Note] InnoDB: 5.7.13 started; log sequence number 2526071
2017-09-04T08:06:17.004484Z 0 [Note] Plugin ‘FEDERATED‘ is disabled.
2017-09-04T08:06:17.005484Z 0 [Note] InnoDB: Loading buffer pool(s) from D:\\work\\data\\ib_buffer_pool
2017-09-04T08:06:17.048476Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2017-09-04T08:06:17.048476Z 0 [Note] Server hostname (bind-address): ‘*‘; port: 3306
2017-09-04T08:06:17.052475Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170904 16:06:17
2017-09-04T08:06:17.055474Z 0 [Note] IPv6 is available.
2017-09-04T08:06:17.063473Z 0 [Note] - ‘::‘ resolves to ‘::‘;
2017-09-04T08:06:17.068472Z 0 [Note] Server socket created on IP: ‘::‘.
2017-09-04T08:06:17.112463Z 0 [Note] Event Scheduler: Loaded 0 events
2017-09-04T08:06:17.112463Z 0 [Note] mysqld: ready for connections.
Version: ‘5.7.13-log‘ socket: ‘‘ port: 3306 MySQL Community Server (GPL)
39
1
D:\\work\\mysql\\bin>start /b mysqld --console -- 后台启动数据库
2
3
D:\\work\\mysql\\bin>2017-09-04T08:06:16.728540Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more de
4
tails).
5
2017-09-04T08:06:16.728540Z 0 [Warning] ‘NO_ZERO_DATE‘, ‘NO_ZERO_IN_DATE‘ and ‘ERROR_FOR_DIVISION_BY_ZERO‘ sql modes should be used with strict mode. They will be merged with strict mode in a future r
6
elease.
7
2017-09-04T08:06:16.728540Z 0 [Warning] ‘NO_AUTO_CREATE_USER‘ sql mode was not set.
8
2017-09-04T08:06:16.728540Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
9
2017-09-04T08:06:16.729539Z 0 [Note] mysqld (mysqld 5.7.13-log) starting as process 7356 ...
10
2017-09-04T08:06:16.735538Z 0 [Warning] No argument was provided to --log-bin, and --log-bin-index was not used; so replication may break when this MySQL server acts as a master and has his hostname c
11
hanged!! Please use ‘--log-bin=YHDZJ-NB2031867-bin‘ to avoid this problem.
12
2017-09-04T08:06:16.745536Z 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
13
2017-09-04T08:06:16.746536Z 0 [Note] InnoDB: Uses event mutexes
14
2017-09-04T08:06:16.746536Z 0 [Note] InnoDB: _mm_lfence() and _mm_sfence() are used for memory barrier
15
2017-09-04T08:06:16.753535Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
16
2017-09-04T08:06:16.759533Z 0 [Note] InnoDB: Number of pools: 1
17
2017-09-04T08:06:16.765532Z 0 [Note] InnoDB: Not using CPU crc32 instructions
18
2017-09-04T08:06:16.782529Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
19
2017-09-04T08:06:16.796526Z 0 [Note] InnoDB: Completed initialization of buffer pool
20
2017-09-04T08:06:16.834518Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
21
2017-09-04T08:06:16.881509Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
22
2017-09-04T08:06:16.882509Z 0 [Note] InnoDB: Setting file ‘.\\ibtmp1‘ size to 12 MB. Physically writing the file full; Please wait ...
23
2017-09-04T08:06:16.925500Z 0 [Note] InnoDB: File ‘.\\ibtmp1‘ size is now 12 MB.
24
2017-09-04T08:06:16.943497Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
25
2017-09-04T08:06:16.945496Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
26
2017-09-04T08:06:16.948496Z 0 [Note] InnoDB: Waiting for purge to start
27
2017-09-04T08:06:17.003485Z 0 [Note] InnoDB: 5.7.13 started; log sequence number 2526071
28
2017-09-04T08:06:17.004484Z 0 [Note] Plugin ‘FEDERATED‘ is disabled.
29
2017-09-04T08:06:17.005484Z 0 [Note] InnoDB: Loading buffer pool(s) from D:\\work\\data\\ib_buffer_pool
30
2017-09-04T08:06:17.048476Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
31
2017-09-04T08:06:17.048476Z 0 [Note] Server hostname (bind-address): ‘*‘; port: 3306
32
2017-09-04T08:06:17.052475Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170904 16:06:17
33
2017-09-04T08:06:17.055474Z 0 [Note] IPv6 is available.
34
2017-09-04T08:06:17.063473Z 0 [Note] - ‘::‘ resolves to ‘::‘;
35
2017-09-04T08:06:17.068472Z 0 [Note] Server socket created on IP: ‘::‘.
36
2017-09-04T08:06:17.112463Z 0 [Note] Event Scheduler: Loaded 0 events
37
2017-09-04T08:06:17.112463Z 0 [Note] mysqld: ready for connections.
38
Version: ‘5.7.13-log‘ socket: ‘‘ port: 3306 MySQL Community Server (GPL)
39
7、修改密码
-- 使用空密码登陆进入mysql修改密码
D:\\work\\mysql\\bin>mysql -uroot -hlocalhost -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \\g.
Your MySQL connection id is 3
Server version: 5.7.13-log MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;‘ or ‘\\h‘ for help. Type ‘\\c‘ to clear the current input statement.
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> set password for [email protected] = password (‘123123‘); --修改密码
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> exit
D:\\work\\mysql\\bin>start /b mysqladmin.exe -uroot -p123123 shutdown --关闭数据库,然后重新启动
x
1
-- 使用空密码登陆进入mysql修改密码
2
D:\\work\\mysql\\bin>mysql -uroot -hlocalhost -p
3
Enter password:
4
Welcome to the MySQL monitor. Commands end with ; or \\g.
5
Your MySQL connection id is 3
6
Server version: 5.7.13-log MySQL Community Server (GPL)
7
8
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
9
10
Oracle is a registered trademark of Oracle Corporation and/or its
11
affiliates. Other names may be trademarks of their respective
12
owners.
13
14
Type ‘help;‘ or ‘\\h‘ for help. Type ‘\\c‘ to clear the current input statement.
15
16
17
mysql> flush privileges;
18
Query OK, 0 rows affected (0.01 sec)
19
20
mysql> set password for [email protected] = password (‘123123‘); --修改密码
21
Query OK, 0 rows affected, 1 warning (0.01 sec)
22
23
24
25
mysql> exit
26
27
D:\\work\\mysql\\bin>start /b mysqladmin.exe -uroot -p123123 shutdown --关闭数据库,然后重新启动
8、服务安装和快速启动
D:\\work\\mysql\\bin>mysqld --install --console
D:\\work\\mysql\\bin> net start mysql
1
1
D:\\work\\mysql\\bin>mysqld --install --console
2
3
D:\\work\\mysql\\bin> net start mysql
二、安装问题
1. 使用 net start mysql 不能启动数据库
现象:
D:\\work\\mysql\\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务无法启动。
服务没有报告任何错误。
请键入 NET HELPMSG 3534 以获得更多的帮助。
D:\\work\\mysql\\bin> NET HELPMSG 3534
服务没有报告任何错误。
D:\\work\\mysql\\bin>
15
1
D:\\work\\mysql\\bin>net start mysql
2
MySQL 服务正在启动 .
3
MySQL 服务无法启动。
4
5
服务没有报告任何错误。
6
7
请键入 NET HELPMSG 3534 以获得更多的帮助。
8
9
10
D:\\work\\mysql\\bin> NET HELPMSG 3534
11
12
服务没有报告任何错误。
13
14
15
D:\\work\\mysql\\bin>
原因:my.ini 配置文件中,错误日志必须要在默认目录下
配置文件:
[mysqld]
log-error = error.log
D:\\work\\mysql\\bin>mysqld --initialize-insecure --console
2017-09-04T07:17:16.798688Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-09-04T07:17:16.798688Z 0 [Warning] ‘NO_ZERO_DATE‘, ‘NO_ZERO_IN_DATE‘ and ‘ERROR_FOR_DIVISION_BY_ZERO‘ sql modes should be used with strict mode. They will be merged with strict mode in a future r
elease.
2017-09-04T07:17:16.798688Z 0 [Warning] ‘NO_AUTO_CREATE_USER‘ sql mode was not set.
2017-09-04T07:17:16.802688Z 0 [Warning] No argument was provided to --log-bin, and --log-bin-index was not used; so replication may break when this MySQL server acts as a master and has his hostname c
hanged!! Please use ‘--log-bin=YHDZJ-NB2031867-bin‘ to avoid this problem.
2017-09-04T07:17:17.256688Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-09-04T07:17:17.342688Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-09-04T07:17:17.438688Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 154d78b0-9141-11e7-a426-00ff
813dc000.
2017-09-04T07:17:17.449688Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed‘ cannot be opened.
2017-09-04T07:17:17.454688Z 1 [Warning] [email protected] is created with an empty password ! Please consider switching off the --initialize-insecure option.
D:\\work\\mysql\\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
x
1
配置文件:
2
[mysqld]
3
log-error = error.log
4
5
6
D:\\work\\mysql\\bin>mysqld --initialize-insecure --console
7
2017-09-04T07:17:16.798688Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
8
2017-09-04T07:17:16.798688Z 0 [Warning] ‘NO_ZERO_DATE‘, ‘NO_ZERO_IN_DATE‘ and ‘ERROR_FOR_DIVISION_BY_ZERO‘ sql modes should be used with strict mode. They will be merged with strict mode in a future r
9
elease.
10
2017-09-04T07:17:16.798688Z 0 [Warning] ‘NO_AUTO_CREATE_USER‘ sql mode was not set.
11
2017-09-04T07:17:16.802688Z 0 [Warning] No argument was provided to --log-bin, and --log-bin-index was not used; so replication may break when this MySQL server acts as a master and has his hostname c
12
hanged!! Please use ‘--log-bin=YHDZJ-NB2031867-bin‘ to avoid this problem.
13
2017-09-04T07:17:17.256688Z 0 [Warning] InnoDB: New log files created, LSN=45790
14
2017-09-04T07:17:17.342688Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
15
2017-09-04T07:17:17.438688Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 154d78b0-9141-11e7-a426-00ff
16
813dc000.
17
2017-09-04T07:17:17.449688Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed‘ cannot be opened.
18
2017-09-04T07:17:17.454688Z 1 [Warning] [email protected] is created with an empty password ! Please consider switching off the --initialize-insecure option.
19
20
21
D:\\work\\mysql\\bin>net start mysql
22
MySQL 服务正在启动 .
23
MySQL 服务已经启动成功。
<wiz_tmp_tag id="wiz-table-range-border" contenteditable="false" style="display: none;">
以上是关于windows-mysql-5.7.13 zip安装的主要内容,如果未能解决你的问题,请参考以下文章