这是我的密码:
import mysql.connector
config = {
'user': 'bb123',\
'password': 'tt',\
'host': 'adb',\
'failover': 'bdb',\
}
self.conn = mysql.connector.connect(**self.config)
但是,我得到了这个错误:
return _get_failover_connection(**kwargs)
File "C:\Python27\lib\site-packages\mysql\connector\__init__.py", line 109, in _get_failover_connection
diff = set(server.keys()) - support_cnx_args
AttributeError: 'str' object has no attribute 'keys'
如何启用故障转移数据库?
1条答案
按热度按时间a14dhokn1#
这个
failover
值应该是包含故障转移服务器的连接详细信息的字典列表或元组。例如。: