最近由于须要测试mysql的多种主从配置方案,因此要安装多个mysql。为了更好的应用机器,干脆就在一台windows机器上安装了多个mysql,用不一样的端口号区别开。那么,最好的选择天然就是安装多个mysql解压版,而不是那种msi安装版,能够达到绿色版的用后即焚效果。html
系统环境: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.htmlmysql
下面开始安装和配置步骤:
1.将下载下来的文件mysql-5.7.13-win32.zip解压至一个分区或者目录中,例如c盘。解压完,会发如今mysql-5.7.13-win32目录下有一个my-default.ini文件。将此文件放到你想放置的目录下,并更名为my.ini,而后编辑之,打开basedir,datadir,port等项,按以下配置:sql
basedir = F:\\mysql-5.7.13-win32 datadir = F:\mysql-5.7.13-win32\\data port = 3306
2.在windows命令行下进入mysql的解压目录,而后执行windows
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
但是我运行完这个命令以后,什么提示也没有出现啊!bash
没管那么多,我开始接着启动mysqldom
F:\mysql-5.7.13-win32\bin>mysqld --console
在命令行显示了如下信息:socket
2016-07-25T11:09:58.866483Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2016-07-25T11:09:58.866483Z 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. 2016-07-25T11:09:58.866483Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set. 2016-07-25T11:09:58.866483Z 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. 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 interlocked 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 size = 128M, instances = 1, chunk size = 128M 2016-07-25T11:09:58.936487Z 0 [Note] InnoDB: Completed initialization of bufferpool 2016-07-25T11:09:59.032492Z 0 [Note] InnoDB: Highest supported file format is Barracuda. 2016-07-25T11:09:59.259505Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables 2016-07-25T11:09:59.260505Z 0 [Note] InnoDB: Setting file '.\ibtmp1' size to 12MB. 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:\mysql-5.7.13-win32\data\ib_buffer_pool 2016-07-25T11:10:01.957660Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private 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 160725 11:10:11
mysql应该是顺利启动了,而后我用mysql客户端软件进行登陆,问题来了,问题再一次如约而至。。。
登陆须要口令,而我却从没获得一个临时生成的口令!这官方安装文档也太坑爹了吧。ide
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。。。了。