1.旧版本jumpserver使用的数据库版本过低为5.1.73
升级到1.4.4版本时,执行脚本修改数据库表结构时报错(sh make_migrations.sh 报错)
报错一:
原因:旧数据库表存储引擎为MYSAM,新数据库存储引擎为INNODB,mysam不支持外键
解决:新版本数据库导入jumpserver数据后,修改数据库表存储引擎
查询出需要修改的库表
SELECT CONCAT(table_name,' ', engine) FROM information_schema.tables WHERE table_schema='jumpserver' AND ENGINE='MyISAM';
查询结果显示所有的50张表均需修改
生成批量修改语句
[root@jumpserver utils]# mysql -uroot -pxxxxxx -S /usr/local/mysql/mysql.sock information_schema -e "select CONCAT('alter table ',table_name,' engine=InnoDB;') FROM information_schema.tables WHERE table_schema='jumpserver' AND ENGINE='MyISAM';" |grep -v CONCAT
alter table assets_adminuser engine=InnoDB;
alter table assets_asset engine=InnoDB;
alter table assets_asset_labels engine=InnoDB;
alter table assets_asset_nodes engine=InnoDB;
alter table assets_assetgroup engine=InnoDB;
alter table assets_cluster engine=InnoDB;
alter table assets_domain engine=InnoDB;
alter table assets_gateway engine=InnoDB;
alter table assets_label engine=InnoDB;
alter table assets_node engine=InnoDB;
alter table assets_systemuser engine=InnoDB;
alter table assets_systemuser_assets engine=InnoDB;
alter table assets_systemuser_nodes engine=InnoDB;
......
进入数据库,复制上述生成的语句进行修改
报错二:
_mysql_exceptions.OperationalError: (1665, ‘Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.’)
原因:innodb的事务隔离级别是read commited或者read uncommited模式时,binlog不可以使用statement模式
解决:
在数据集配置文件中设定二进制日志格式为MIXED,重启数据库
binlog_format=MIXED
不重启解决方法
SET GLOBAL binlog_format = MIXED
2.数据库连接失败
原因:配置文件中的数据库地址、密码等没有加引号,导致识别出错
解决:给mysql相关配置添加引号
3.pip安装依赖包出现冲突
查看哪些包出现冲突,安装正确的版本包
下面这2个冲突可以忽略