欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

windows系统下安装最新mysql 5.7.13解压版

程序员文章站 2022-06-12 14:21:36
...
最近因为需要测试mysql的多种主从配置方案,所以要安装多个mysql。为了更好的应用机器,干脆就在一台windows机器上安装了多个mysql,用不同的端口号区别开。那么,最好的选择自然就是安装多个mysql解压版,而不是那种msi安装版,可以达到绿色版的用后即焚效果。

系统环境:win 7,32位系统
mysql版本:5.7.13社区版
mysql下载地址:http://dev.mysql.com/downloads/mysql/,我下载的是大小为296.5M的
Windows (x86, 32-bit), ZIP Archive
mysql官方安装文档:http://dev.mysql.com/doc/refman/5.7/en/windows-install-archive.html

下面开始安装和配置步骤:
1.将下载下来的文件mysql-5.7.13-win32.zip解压至一个分区或者目录中,例如c盘。解压完,会发现在mysql-5.7.13-win32目录下有一个my-default.ini文件。将此文件放到你想放置的目录下,并改名为my.ini,然后编辑之,打开basedir,datadir,port等项,按如下配置:
basedir = F:\\mysql-5.7.13-win32
datadir = F:\mysql-5.7.13-win32\\data
port = 3306

2.在windows命令行下进入mysql的解压目录,然后执行
F:\mysql-5.7.13-win32\bin>mysqld --defaults-file=F:\mysql-5.7.13-win32\my.ini --initialize

按照官方安装文档的说明,在初始化完,会给出一个root账号的临时随机密码,下面这段话摘录自官方文档:
With --initialize but not --initialize-insecure, the server generates a random password, marks it as expired, and writes a message displaying the password:

[Warning] A temporary password is generated for root@localhost:
iTag*AfrH5ej

可是我运行完这个命令之后,什么提示也没有出现啊!

没管那么多,我开始接着启动mysql
F:\mysql-5.7.13-win32\bin>mysqld --console

在命令行显示了以下信息:
2016-07-25T11:09:58.866483Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is
 deprecated. Please use --explicit_defaults_for_timestamp server option (see doc
umentation for more details).
2016-07-25T11:09:58.866483Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'E
RROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will
be merged with strict mode in a future release.
2016-07-25T11:09:58.866483Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not s
et.
2016-07-25T11:09:58.866483Z 0 [Warning] Insecure configuration for --secure-file
-priv: Current value does not restrict location of generated files. Consider set
ting it to a valid, non-empty path.
2016-07-25T11:09:58.867483Z 0 [Note] mysqld (mysqld 5.7.13) starting as process
9112 ...
2016-07-25T11:09:58.878483Z 0 [Note] InnoDB: Mutexes and rw_locks use Windows in
terlocked functions
2016-07-25T11:09:58.879483Z 0 [Note] InnoDB: Uses event mutexes
2016-07-25T11:09:58.880484Z 0 [Note] InnoDB: Memory barrier is not used
2016-07-25T11:09:58.881484Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-07-25T11:09:58.883484Z 0 [Note] InnoDB: Number of pools: 1
2016-07-25T11:09:58.902485Z 0 [Note] InnoDB: Not using CPU crc32 instructions
2016-07-25T11:09:58.916486Z 0 [Note] InnoDB: Initializing buffer pool, total siz
e = 128M, instances = 1, chunk size = 128M
2016-07-25T11:09:58.936487Z 0 [Note] InnoDB: Completed initialization of buffer
pool
2016-07-25T11:09:59.032492Z 0 [Note] InnoDB: Highest supported file format is Ba
rracuda.
2016-07-25T11:09:59.259505Z 0 [Note] InnoDB: Creating shared tablespace for temp
orary tables
2016-07-25T11:09:59.260505Z 0 [Note] InnoDB: Setting file '.\ibtmp1' size to 12
MB. Physically writing the file full; Please wait ...
2016-07-25T11:10:00.166557Z 0 [Note] InnoDB: File '.\ibtmp1' size is now 12 MB.
2016-07-25T11:10:00.171557Z 0 [Note] InnoDB: 96 redo rollback segment(s) found.
96 redo rollback segment(s) are active.
2016-07-25T11:10:00.174558Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are
 active.
2016-07-25T11:10:00.175558Z 0 [Note] InnoDB: Waiting for purge to start
2016-07-25T11:10:00.336567Z 0 [Note] InnoDB: 5.7.13 started; log sequence number
 2524844
2016-07-25T11:10:00.338567Z 0 [Note] Plugin 'FEDERATED' is disabled.
2016-07-25T11:10:00.353568Z 0 [Note] InnoDB: Loading buffer pool(s) from F:\mysq
l-5.7.13-win32\data\ib_buffer_pool
2016-07-25T11:10:01.957660Z 0 [Warning] Failed to set up SSL because of the foll
owing SSL library error: SSL context is not usable without certificate and priva
te key
2016-07-25T11:10:01.959660Z 0 [Note] Server hostname (bind-address): '*'; port:
3306
2016-07-25T11:10:01.962660Z 0 [Note] IPv6 is available.
2016-07-25T11:10:01.965660Z 0 [Note]   - '::' resolves to '::';
2016-07-25T11:10:01.969660Z 0 [Note] Server socket created on IP: '::'.
2016-07-25T11:10:06.438916Z 0 [Note] Event Scheduler: Loaded 0 events
2016-07-25T11:10:06.439916Z 0 [Note] mysqld: ready for connections.
Version: '5.7.13'  socket: ''  port: 3306  MySQL Community Server (GPL)
2016-07-25T11:10:11.615212Z 0 [Note] InnoDB: Buffer pool(s) load completed at 16
0725 11:10:11

mysql应该是顺利启动了,然后我用mysql客户端软件进行登录,问题来了,问题再一次如约而至。。。
登录需要口令,而我却从没得到一个临时生成的口令!这官方安装文档也太坑爹了吧。

3.这下又陷入一筹莫展了,思考了一会儿,我想要不就试试--initialize-insecure参数吧,毕竟insecure是不安全的意思。。。

于是我停止mysql,删除了已经初始化的data目录,执行下面的命令,重新进行初始化:
F:\mysql-5.7.13-win32\bin>mysqld --defaults-file=F:\mysql-5.7.13-win32\my.ini --initialize-insecure

和之前一样,还是没有出现任何提示就运行完成了。
再次启动mysql
F:\mysql-5.7.13-win32\bin>mysqld --console

然后我再次使用navicat客户端软件进行登录,将口令设置为空,这次成功登录mysql!
当然,登录后记得修改root密码。

4.最后,解压版安装完,发现整个mysql已经达到了1.66G,实在是很占用硬盘空间。
当然,接下来就可以继续以解压方式安装3307,3308,3309。。。了。