mysql一机多实例安装记录
因为想研究mycat,所以需要安装多个mysql实例进行研究。限于没有多于计算机,只能在本机安装了。通过mysql文档,自己琢磨着安装成功!
目录结构如下:
其中one和two文件夹用来模拟数据库分库。
操作步骤:
拷贝文件
拷贝mysql-5.7.9-win64目录下的my-default.ini分别到whole、one、two目录下,更名为my.init。
以whole库 为例说明,one库和two库做相应调整即可。
1、编写\instance\whole\my.init
innodb_buffer_pool_size = 128M
basedir = E:\mysql\mysql-5.7.9-winx64
datadir = E:\mysql\mysql-5.7.9-winx64\instance\whole\data
port = 3309
server_id = 3
对于分库two要注意:
3、Initializing the Data Directory
mysqld --defaults-file=E:\mysql\instance\whole\my.ini --initialize --console
2017-01-23T01:31:39.492351Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defau
lts_for_timestamp server option (see documentation for more details).
2017-01-23T01:31:39.492351Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes sho
uld be used with strict mode. They will be merged with strict mode in a future release.
2017-01-23T01:31:39.492351Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2017-01-23T01:31:41.487351Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-01-23T01:31:41.980351Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-01-23T01:31:42.145351Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that t
his server has been started. Generating a new UUID: b192bf10-e10b-11e6-b19c-00ffcdaad4ca.
2017-01-23T01:31:42.193351Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened
.
2017-01-23T01:31:42.218351Z 1 [Note] A temporary password is generated for root@localhost: g0tN0uAqak>e
4、启动服务
mysqld --defaults-file=E:\mysql\instance\whole\my.ini --console
5、测试连接:
mysql -h localhost -u root --port 3309 -p
mysql> set password=password('123');
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql 文档中,修改密码用的是:ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
mysql> alter user 'root'@'localhost' password expire never;
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
6、关闭服务
mysqladmin -h localhost --port 3309 -p -u root shutdown
7、安装为服务
mysqld --install-manual MySqlWhole --defaults-file=E:\mysql\instance\whole\my.ini
Service successfully installed.
windows服务管理中:
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· 展开说说关于C#中ORM框架的用法!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?