Error Code: 1054. Unknown column 'age' in 'user'

本文详细解析了在MySQL中使用ALTER TABLE语句修改表结构时遇到未知字段错误的原因,并提供了完整的解决方案。通过先在表中插入缺失字段,再调整其位置,可以避免此类常见错误。

1、错误描述

10:28:20	alter table user modify age int(3) after sex	Error Code: 1054. Unknown column 'age' in 'user'	0.000 sec

2、错误原因

原本在user表中有age字段,但是在测试阶段删除了,后期将age位置修改,所以报错


3、解决办法

首先,先向user表中插入age字段;然后再修改它的位置

ERROR: Failed :entry:default@PreviewArkTS... > hvigor ERROR: 10605093 ArkTS Compiler Error Error Message: Using "this" inside stand-alone functions is not supported (arkts-no-standalone-this) At File: C:/Users/24738/Desktop/MeApp/entry/src/main/ets/utils/StorageUtil.ets:7:19 10605040 ArkTS Compiler Error Error Message: Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types) At File: C:/Users/24738/Desktop/MeApp/entry/src/main/ets/utils/StorageUtil.ets:6:24 10605040 ArkTS Compiler Error Error Message: Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types) At File: C:/Users/24738/Desktop/MeApp/entry/src/main/ets/utils/StorageUtil.ets:12:28 10605008 ArkTS Compiler Error Error Message: Use explicit types instead of "any", "unknown" (arkts-no-any-unknown) At File: C:/Users/24738/Desktop/MeApp/entry/src/main/ets/utils/StorageUtil.ets:13:11 10605093 ArkTS Compiler Error Error Message: Using "this" inside stand-alone functions is not supported (arkts-no-standalone-this) At File: C:/Users/24738/Desktop/MeApp/entry/src/main/ets/utils/StorageUtil.ets:19:19 10605038 ArkTS Compiler Error Error Message: Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals) At File: C:/Users/24738/Desktop/MeApp/entry/src/main/ets/utils/StorageUtil.ets:20:16 10605040 ArkTS Compiler Error Error Message: Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types) At File: C:/Users/24738/Desktop/MeApp/entry/src/main/ets/utils/StorageUtil.ets:24:28 10605008 ArkTS Compiler Error Error Message: Use explicit types instead of "any", "unknown" (arkts-no-any-unknown) At File: C:/Users/24738/Desktop/MeApp/entry/src/main/ets/utils/StorageUtil.ets:25:11 10605093 ArkTS Compiler Error Error Message: Using "this" inside stand-alone functions is not supported (arkts-no-standalone-this) At File: C:/Users/24738/Desktop/MeApp/entry/src/main/ets/utils/StorageUtil.ets:30:17 10605038 ArkTS Compiler Error Error Message: Object literal must correspond to some explicitly declared class or interface (arkts-no-untyped-obj-literals) At File: C:/Users/24738/Desktop/MeApp/entry/src/main/ets/pages/Register.ets:26:31 10605040 ArkTS Compiler Error Error Message: Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types) At File: C:/Users/24738/Desktop/MeApp/entry/src/main/ets/pages/MemoList.ets:8:23 10605008 ArkTS Compiler Error Error Message: Use explicit types instead of "any", "unknown" (arkts-no-any-unknown) At File: C:/Users/24738/Desktop/MeApp/entry/src/main/ets/pages/MemoList.ets:13:30 10505001 ArkTS Compiler Error Error Message: Module '"@ohos.data.preferences"' has no exported member 'preferences'. Did you mean to use 'import preferences from "@ohos.data.preferences"' instead? At File: C:/Users/24738/Desktop/MeApp/entry/src/main/ets/utils/StorageUtil.ets:2:9 10505001 ArkTS Compiler Error Error Message: Module '"@ohos.router"' has no exported member 'router'. Did you mean to use 'import router from "@ohos.router"' instead? At File: C:/Users/24738/Desktop/MeApp/entry/src/main/ets/pages/Login.ets:2:9 10505001 ArkTS Compiler Error Error Message: Argument of type '{ placeholder: string; type: InputType; }' is not assignable to parameter of type 'TextInputOptions'. Object literal may only specify known properties, and 'type' does not exist in type 'TextInputOptions'. At File: C:/Users/24738/Desktop/MeApp/entry/src/main/ets/pages/Login.ets:16:38 10505001 ArkTS Compiler Error Error Message: Argument of type '{ placeholder: string; type: InputType; }' is not assignable to parameter of type 'TextInputOptions'. Object literal may only specify known properties, and 'type' does not exist in type 'TextInputOptions'. At File: C:/Users/24738/Desktop/MeApp/entry/src/main/ets/pages/Register.ets:16:38 10505001 ArkTS Compiler Error Error Message: Argument of type '{ placeholder: string; type: InputType; }' is not assignable to parameter of type 'TextInputOptions'. Object literal may only specify known properties, and 'type' does not exist in type 'TextInputOptions'. At File: C:/Users/24738/Desktop/MeApp/entry/src/main/ets/pages/Register.ets:18:40 10505001 ArkTS Compiler Error Error Message: Module '"@ohos.router"' has no exported member 'router'. Did you mean to use 'import router from "@ohos.router"' instead? At File: C:/Users/24738/Desktop/MeApp/entry/src/main/ets/pages/MemoList.ets:2:9 10505001 ArkTS Compiler Error Error Message: Module '"@ohos.router"' has no exported member 'router'. Did you mean to use 'import router from "@ohos.router"' instead? At File: C:/Users/24738/Desktop/MeApp/entry/src/main/ets/pages/AddMemo.ets:2:9 10905220 ArkTS Compiler Error Error Message: The 'ListItem' component can have only one child component. At File: C:/Users/24738/Desktop/MeApp/entry/src/main/ets/pages/MemoList.ets:14:11 * Try: > Run with --stacktrace option to get the stack trace. > Run with --debug option to get more log output. > hvigor ERROR: BUILD FAILED in 9 s 435 ms Process finished with exit code -1
最新发布
11-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值