lf知识星球banner

基础数据初始化(升级)

2018-03-13 20:18:51
admin
50000
最后编辑:Seagull 于 2020-02-11 10:46:06
简介:当你安装完数据库后,就可以先对数据进行初始化了,接下来将详细为你介绍数据初始化或是版本升级后数据结构升级的步骤

注意:V3.2以上的版本已经使用FlyWay自动初始化以及升级数据库,无需手动执行以下步骤,所以此章节可以忽略。


在服务端项目 LuckyFrameWeb的根目录下,有一个 mysqldb的文件夹,此文件夹中包含了2个子文件夹:

文件夹 initialization(create table) 此目录是项目数据初始化的路径,如果你是第一次安装环境,那么可以进入到此路径下,此文件夹中包含了各种版本的初始化SQL文件,找到自己下载项目所属版本的SQL文件,去执行SQL即可。


文件夹  update(alter table) 此目录是项目升级需要的SQL路径,如果你现在想把旧版本升级到最新版本,找到对应的更新SQL文件,执行即可。

注意: 不可跨级更新,比如你现在是2.4版本,想升级到2.6版本,那么你必须先执行【 V2.4 upgrade V2.5】中的文件,升级到V2.5版本的数据结构,再执行【 V2.5 upgrade V2.6】中的文件,升级到V2.6。

从V2.X升级到V3.X由于是属于重构级别,所以不能直接升级,需要先执行V3.X版本的初始化SQL文件,再执行V2.7.2升级到V3.0的升级SQL文件,对数据进行迁移,具体操作可参照升级文章,后续会提供。

评论列表
雷伦特 2023-06-10 14:24:34 回复
启动报错,应该是初始化数据库有问题,这个怎么破解
13:40:55.617 [main] WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - [refresh,554] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'luckyFrameWebApplication': Unsatisfied dependency expressed through field 'server'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'nettyServer': Unsatisfied dependency expressed through field 'serverChannelInitializer'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'serverChannelInitializer': Unsatisfied dependency expressed through field 'serverHandler'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ServerHandler': Unsatisfied dependency expressed through field 'clientService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'clientServiceImpl': Unsatisfied dependency expressed through field 'jobService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayConfig': Invocation of init method failed; nested exception is org.flywaydb.core.internal.exception.FlywaySqlException:
Unable to check whether schema `luckyframe` is empty
----------------------------------------------------
SQL State : HY000
Error Code : 1577
Message : Cannot proceed, because event scheduler is disabled

13:40:55.632 [main] INFO c.a.d.p.DruidDataSource - [close,1825] - {dataSource-1} closed
13:40:55.639 [main] INFO o.a.c.c.StandardService - [log,173] - Stopping service [Tomcat]
13:40:55.664 [main] ERROR o.s.b.SpringApplication - [reportFailure,858] - Application run failed
may 2023-04-18 08:33:47 回复
3.5.1版本的安装包,并没有自动执行sql
may 2023-04-18 08:31:49 回复
3.5.1启动服务端程序并没有自动建库建表
rh 2021-10-08 11:54:22 回复
你好,下载了3.4的jar包,不用手动执行MySQL语句吗,直接运行Jar包就可以了?
Seagull 2021-11-01 17:14:54 回复
是的,不需要手动执行SQL
mmx 2021-06-10 18:51:51 回复
MariaDB [(none)]> source /home/luckyframefiles/v3.2.sql
ERROR: Failed to open file '/home/luckyframefiles/v3.2.sql', error: 2

执行sql 提示不能打开啊,求救!!!
灵儿的逍遥哥哥 2021-05-16 19:26:26 回复
执行sql之前应该还需要启动数据库,idea中配置项目的mysql数据库吧,不讲一下,我这个新手心里还真没底。。。。
Seagull 2021-05-20 16:44:25 回复
执行SQL,需要先启动数据库,这个.....不需要单独说明吧~—~
zhubo 2020-11-17 14:48:50 回复
master分支启动报错,3.2.1 3.1.1 版本都报错, sql脚本有问题呀 ~~~ 无语了
speedcom 2020-05-12 13:04:16 回复
idea环境安装启动,db初始化3.2sql没有问题,idea启动很多错误。清数据库,换成初始化3.1.1sql,idea顺利启动
Seagull 2020-05-13 13:50:57 回复
3.2以上的版本,不再需要单独执行SQL了,应用启动的时候会自动检测并创建对应的表结构。
老男人 2020-02-18 16:32:29 回复



你好 执行3.1.1版本,初始化数据的时候报这个错误,请问是什么原因?[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
jia 2020-01-29 23:17:25 回复
执行3.1.1sql,在导入的时候,部分字段会报1406和1366的错误,如下。还有数据库名字必须是luckyframedb,怎么在数据库安装配置说的是数据库名是luckyframe,懵了。。。

ERROR 1406 (22001): Data too long for column 'dict_label' at row 1
ERROR 1406 (22001): Data too long for column 'dict_label' at row 1
ERROR 1406 (22001): Data too long for column 'dict_label' at row 1
ERROR 1366 (HY000): Incorrect string value: '\x80\x81Post...' for column 'dict_label' at row 1
ERROR 1366 (HY000): Incorrect string value: '\x80\x81Get\xE8...' for column 'dict_label' at row 1
ERROR 1366 (HY000): Incorrect string value: '\x80\x81JSON...' for column 'dict_label' at row 1
ERROR 1366 (HY000): Incorrect string value: '\x80\x81Put\xE8...' for column 'dict_label' at row 1
ERROR 1366 (HY000): Incorrect string value: '\x80\x81JSON...' for column 'dict_label' at row 1
Seagull 2020-02-05 18:29:35 回复
看下你的数据库版本是不是5.7,建议使用5.7的版本
达达的马蹄 2020-05-20 17:39:47 回复
数据库版本一定要是5.7么? 看说明是大于5.7 就行? 我是8.0的
出错:
Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.01 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.01 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected, 7 warnings (0.02 sec)

ERROR 1406 (22001): Data too long for column 'dept_name' at row 1
ERROR 1406 (22001): Data too long for column 'dept_name' at row 1
ERROR 1406 (22001): Data too long for column 'dept_name' at row 1
Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected, 3 warnings (0.01 sec)

ERROR 1406 (22001): Data too long for column 'project_name' at row 1
Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected, 13 warnings (0.01 sec)

ERROR 1406 (22001): Data too long for column 'remark' at row 1
Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected, 4 warnings (0.01 sec)

Query OK, 1 row affected (0.00 sec)

ERROR 1366 (HY000): Incorrect string value: '\x80\xE5\x8F\x91\xE5\xB7...' for column 'post_name' at row 1
Query OK, 1 row affected (0.00 sec)

ERROR 1406 (22001): Data too long for column 'post_name' at row 1
Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected, 7 warnings (0.02 sec)

ERROR 1406 (22001): Data too long for column 'role_name' at row 1
ERROR 1366 (HY000): Incorrect string value: '\xAE\xE9\x80\x9A\xE8\xA7...' for column 'role_name' at row 1
Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected, 6 warnings (0.03 sec)

ERROR 1366 (HY000): Incorrect string value: '\xAE\xE5\xBD\x95' for column 'remark' at row 1
ERROR 1366 (HY000): Incorrect string value: '\xAE\xE5\xBD\x95' for column 'remark' at row 1
ERROR 1366 (HY000): Incorrect string value: '\xAE\xE5\xBD\x95' for column 'remark' at row 1
Query OK, 1 row affected (0.00 sec)

ERROR 1366 (HY000): Incorrect string value: '\xA1\x8C' for column 'menu_name' at row 1
Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.01 sec)

Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.01 sec)

ERROR 1366 (HY000): Incorrect string value: '\xAF\xE7\xAE\xA1\xE7\x90...' for column 'menu_name' at row 1
Query OK, 1 row affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

ERROR 1366 (HY000): Incorrect string value: '\xAC\xE5\x91\x8A' for column 'menu_name' at row 1
Query OK, 1 row affected (0.00 sec)
1/2
发表评论
评论通过审核后显示。
付费知识圈