一、安装步骤
1、环境介绍
安装机器
window7 64bit 8G内存
mysql版本
mysql-5.7.13-winx64.zip
2、下载
下载地址:
3、解压
解压位置:
D:\work\mysql
4、修改配置文件
1. 备份my-default.ini
2. 修改内容:
[mysql]default-character-set=utf8[mysqld]server_id = 1basedir = D:\work\mysqldatadir = D:\work\dataport = 3306#loglog-binlog-error = D:\work\log\error.log# 使用默认的位置log-error = error.log ,不然net start mysql 不能启动;--console, mysqld将错误消息写入控制台。--log-error如果给出,则被忽略并且没有效果。slow_query_log_file = D:\work\log\slow.log# join_buffer_size = 128M# sort_buffer_size = 2M# read_rnd_buffer_size = 2Msql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
5、初始化数据库
win+R 打开运行,输入cmd,召唤cmd窗口,注意需要管理员权限。C:\Users\aijie>D:D:\>cd work\mysql\binD:\work\mysql\bin>mysqld --initialize-insecure --console2017-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 release.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 changed!! 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=457902017-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-00ff813dc000.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] root@localhost 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 details).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 release.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 changed!! 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 functions2017-09-04T08:06:16.746536Z 0 [Note] InnoDB: Uses event mutexes2017-09-04T08:06:16.746536Z 0 [Note] InnoDB: _mm_lfence() and _mm_sfence() are used for memory barrier2017-09-04T08:06:16.753535Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.32017-09-04T08:06:16.759533Z 0 [Note] InnoDB: Number of pools: 12017-09-04T08:06:16.765532Z 0 [Note] InnoDB: Not using CPU crc32 instructions2017-09-04T08:06:16.782529Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M2017-09-04T08:06:16.796526Z 0 [Note] InnoDB: Completed initialization of buffer pool2017-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 tables2017-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 start2017-09-04T08:06:17.003485Z 0 [Note] InnoDB: 5.7.13 started; log sequence number 25260712017-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_pool2017-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 key2017-09-04T08:06:17.048476Z 0 [Note] Server hostname (bind-address): '*'; port: 33062017-09-04T08:06:17.052475Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170904 16:06:172017-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 events2017-09-04T08:06:17.112463Z 0 [Note] mysqld: ready for connections.Version: '5.7.13-log' socket: '' port: 3306 MySQL Community Server (GPL)
7、修改密码
登录修改密码:
D:\work\mysql\bin>mysql -uroot -hlocalhost -p -- 使用空密码登陆进入mysql修改密码mysql> flush privileges;mysql> set password for root@localhost = password ('123123'); --修改密码D:\work\mysql\bin> mysqladmin.exe -uroot -p123123 shutdown --关闭数据库,然后重新启动
8、服务安装和快速启动
安装服务
C:\Users\aijie>D:D:\>cd work\mysql\binD:\work\mysql\bin> mysqld.exe --install mysqld //mysqld.exe 安装为mysqld服务,运行services.msc 可查看Service successfully installed.
启动服务
D:\work\mysql\bin>net start mysqldmysqld 服务正在启动 .mysqld 服务已经启动成功。
删除服务
D:\work\mysql\bin>sc delete mysqld[SC] DeleteService 成功
二、安装遇到的问题
1. 初始化正常但是不能启动数据库
现象:
D:\work\mysql\bin>net start mysqlMySQL 服务正在启动 .MySQL 服务无法启动。服务没有报告任何错误。请键入 NET HELPMSG 3534 以获得更多的帮助。D:\work\mysql\bin> NET HELPMSG 3534服务没有报告任何错误。
原因
my.ini 配置文件中,错误日志必须要在默认目录下
解决方案:
修改my.ini
[mysqld]log-error = error.log
2、服务启动正常,但是不能登陆windows-mysql安装'::1' is not allowed to connect to this MySQL server'
现象:
D:\work\mysql\bin>mysql -uroot -pEnter password:ERROR 1130 (HY000): Host '::1' is not allowed to connect to this MySQL server
原因:
在启动时,查看错误日志,提示进入了 --skip-name-resolve mode.
解决方案:
在配置文件中注释掉#skip_name_resove
<wiz_tmp_tag id="wiz-table-range-border" contenteditable="false" style="display: none;">