keystone 无法导入解决方法
更新:HHH   时间:2023-1-7


su -s /bin/sh -c “keystone-manage db_sync” keystone 无法导入解决方法
其中出现以下两个问题:
SQL connection failed. 9 attempts left.: DBConnectionError: (pymysql.err.OperationalError) (2003, “Can’t connect to MySQL server on ‘allone’ ([Errno 111] Connection refused)”)
ERROR keystone DBError: (pymysql.err.InternalError) (1071, u’Specified key was too long; max key length is 767 bytes’) [SQL: u’\nCREATE TABLE migrate_version (\n\trepository_id VARCHAR(250) NOT NULL, \n\trepository_path TEXT, \n\tversion INTEGER, \n\tPRIMARY KEY (repository_id)\n)\n\n’]
我的keystone配置文件没有错误:/etc/keystone/keystone.conf
如:[database]
connection = mysql+pymysql://keystone:password@allone/keystone
解决方法:编辑该文件 :vi /etc/mysql/mariadb.conf.d/50-server.cnf
bind-address 192.168.104.10 ##改成主机名(我的是allone)所对应的IP地址
character-set-server = utf8 ##字符集改成这样
collation-server = utf8_general_ci
改完后删除keystone数据库
删除用户及授权
如:drop ‘keystone’@’localhost’;
drop ‘keystone’@’%’;
重启mysql
重建数据库和重新授权
su -s /bin/sh -c “keystone-manage db_sync” keystone
查看/var/log/keystone/keystone-manage.log是否导入,查看数据库keystone有表,成功

返回云计算教程...