please use a valid, non-local hostname or IP. localhost can only be used with sandbox MySQL instance

本文解决在MySQL 5.7.24版本中配置InnoDB Cluster时遇到的错误,详细介绍了如何避免使用localhost连接,转而使用有效IP进行集群创建的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题描述

MySQL InnoDB Cluster配置过程中出错,版本5.7.24

 MySQL  localhost:3307  JS > var cluster = dba.createCluster('myCluster');
A new InnoDB cluster will be created on instance 'root@localhost:3307'.

Validating instance at localhost:3307...

This instance reports its own address as cmiot1

Instance configuration is suitable.
Creating InnoDB cluster 'myCluster' on 'root@localhost:3307'...
Dba.createCluster: To add an instance to the cluster, please use a valid, non-local hostname or IP. localhost can only be used with sandbox MySQL instances. (RuntimeError)

根据错误提示,在使用shell时不可使用localhost连接,而应该使用有效的非localhost名和ip作为连接名,应为localhost只在沙箱环境实例中使用。

解决方法

退出MySQL Shell

 MySQL  localhost:3307  JS > \q

利用ip连接shell

[root@cmiot1 mysqlmaster]# mysqlsh
 MySQL  JS > shell.connect('root@192.168.233.136:3307');

再次按照创建集群的步骤即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值