运行环境框架包
下载地址:mycat2-install-template-1.20.zip
运行包
下载地址:mycat2-1.21-release-jar-with-dependencies.jar
说明
解压运行环境框架包,将运行包放到mycat的lib目录下
配置数据源
打开conf/datasources/prototypeDs.datasource.json,修改password和url
{"dbType":"mysql","idleTimeout":60000,"initSqls":[],"initSqlsGetConnection":true,"instanceType":"READ_WRITE","maxCon":1000,"maxConnectTimeout":3000,"maxRetryCount":5,"minCon":1,"name":"prototypeDs","password":"123456","type":"JDBC","url":"jdbc:mysql://localhost:3306/mysql?useUnicode=true&serverTimezone=Asia/Shanghai&characterEncoding=UTF-8","user":"root","weight":0
}
配置用户名和密码
打开conf/users/root.user.json
{"dialect":"mysql","ip":null,"password":"123456","transactionType":"xa","username":"root"
}
运行mycat2
以管理员身份运行命令提示符,进入bin目录
安装为windows服务
mycat install
启动mycat2
mycat start
连接mycat2
mysql -h127.0.0.1 -P8066 -uroot -p123456
连接mycat2管理
mysql -h127.0.0.1 -P9066 -uroot -p123456