CREATE TABLE出错 [英] Error in CREATE TABLE

查看:69
本文介绍了CREATE TABLE出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试运行一些mysql脚本时遇到错误(从2001年开始)。它

给出了如下错误:

$ 48 $ b错误1067(42000)第48行:''log_id'的默认值无效
<声明中的


CREATE TABLE Log(

log_id int(11)DEFAULT''0''NOT NULL auto_increment,

source_id smallint(6)DEFAULT''0''NOT NULL,

l_time datetime DEFAULT'' 0000-00-00 0000-00-00 00:00:00''NOT NULL,

l_nanos int(11)DEFAULT''0''NOT NULL,

l_message text,

PRIMARY KEY(log_id)

);


这是什么?我不熟悉mysql,这个脚本是

的另一个安装脚本的一部分,该脚本是2001年由不再存在的

公司制作的。我们需要将运行

程序的机器(redhat 8)升级到RedHat ES 4.现在安装

脚本给我们这个错误。


请帮忙。

解决方案



< il **** *******@hotmail.com>在消息中写道

news:11 ********************** @ j33g2000cwa.googlegr oups.com ...

我在尝试运行一些mysql脚本时遇到错误(从2001年开始)。它给出了如下错误:

第48行的ERROR 1067(42000):语句中''log_id''

的默认值无效: br />
CREATE TABLE日志(
log_id int(11)DEFAULT''0''NOT NULL auto_increment,
source_id smallint(6)DEFAULT''0''NOT NULL,
l_time datetime DEFAULT''for 0000-00-00 00:00:00''NOT NULL,
l_nanos int(11)DEFAULT''0''NOT NULL,
l_message text, PRIMARY KEY(log_id)
);

这是什么?我不熟悉mysql,该脚本是
公司2001年制作的程序的另一个安装脚本的一部分,该程序不再存在。我们需要将运行
程序的机器(redhat 8)升级到RedHat ES 4.现在安装
脚本给我们这个错误。




您的错误消息声称MySQL在这8行的第48行窒息

脚本!


我怀疑你没有注意到文字掉落离开你的屏幕

超出这个简短的CREATE TABLE语句。


向下滚动!

Thomas Bartkus


il***********@hotmail.com 写道:

我在尝试运行一些mysql脚本时遇到错误(从2001年开始)。它给出了如下错误:
ERROR 1067(42000)第48行:语句中''log_id''
的默认值无效:
CREATE TABLE Log(
log_id int(11)DEFAULT''0''NOT NULL auto_increment,
source_id smallint(6)DEFAULT''0''NOT NULL,
l_time datetime DEFAULT''
00:00:00''NOT NULL,
l_nanos int(11)DEFAULT''0''NOT NULL,
l_message text,
PRIMARY KEY(log_id)
);
这是什么?我不熟悉mysql,该脚本是
公司2001年制作的程序的另一个安装脚本的一部分,该程序不再存在。我们需要将运行
程序的机器(redhat 8)升级到RedHat ES 4.现在安装
脚本给我们这个错误。
请帮忙。



log_id,l_nanos是INT数据类型..应该是... DEFAULT 0 ....

注意没有报价! !!


< il *********** @ hotmail.com>在消息中写道

news:11 ********************** @ j33g2000cwa.googlegr oups.com ...

我在尝试运行一些mysql脚本时遇到错误(从2001年开始)。它给出了如下错误:

第48行的ERROR 1067(42000):语句中''log_id''

的默认值无效: br />
CREATE TABLE日志(
log_id int(11)DEFAULT''0''NOT NULL auto_increment,
source_id smallint(6)DEFAULT''0''NOT NULL,
l_time datetime DEFAULT''for 0000-00-00 00:00:00''NOT NULL,
l_nanos int(11)DEFAULT''0''NOT NULL,
l_message text, PRIMARY KEY(log_id)
);

这是什么?我不熟悉mysql,该脚本是
公司2001年制作的程序的另一个安装脚本的一部分,该程序不再存在。我们需要将运行
程序的机器(redhat 8)升级到RedHat ES 4.现在安装
脚本给我们这个错误。

请帮助。




没关系!我应该在回复之前尝试一下。 Mea culpa!


当我这样做时,我注意到你要为

auto_increment字段[log_id]声明默认值''0'。在MySQL 4.1x中无法做到。想想

吧,auto_increment字段中的默认值是什么意思?

删除DEFUALT''0''"从log_id行开始,它运行正常。


顺便说一句 - 我还是会检查第48行及以后的更多文字。

Thomas Bartkus


I am having error trying to run some mysql script (back from 2001). It
gives me the error like :

ERROR 1067 (42000) at line 48: Invalid default value for ''log_id''

in the statement :

CREATE TABLE Log (
log_id int(11) DEFAULT ''0'' NOT NULL auto_increment,
source_id smallint(6) DEFAULT ''0'' NOT NULL,
l_time datetime DEFAULT ''0000-00-00 00:00:00'' NOT NULL,
l_nanos int(11) DEFAULT ''0'' NOT NULL,
l_message text,
PRIMARY KEY (log_id)
);

What is this? I am not familiar with mysql, the script is part of
another installation script for the program made in 2001 by the
company that no longer exists. We needed to upgrade the machine the
program was running (redhat 8) to the RedHat ES 4. Now the installation
script gives us this error.

Please help.

解决方案


<il***********@hotmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...

I am having error trying to run some mysql script (back from 2001). It
gives me the error like :

ERROR 1067 (42000) at line 48: Invalid default value for ''log_id''

in the statement :

CREATE TABLE Log (
log_id int(11) DEFAULT ''0'' NOT NULL auto_increment,
source_id smallint(6) DEFAULT ''0'' NOT NULL,
l_time datetime DEFAULT ''0000-00-00 00:00:00'' NOT NULL,
l_nanos int(11) DEFAULT ''0'' NOT NULL,
l_message text,
PRIMARY KEY (log_id)
);

What is this? I am not familiar with mysql, the script is part of
another installation script for the program made in 2001 by the
company that no longer exists. We needed to upgrade the machine the
program was running (redhat 8) to the RedHat ES 4. Now the installation
script gives us this error.



Your error message claims MySQL to be choking on line #48 of this 8 line
script!

I suspect you are failing to notice text falling off your screen somewhere
beyond this short CREATE TABLE statement.

Scroll down!
Thomas Bartkus


il***********@hotmail.com wrote:

I am having error trying to run some mysql script (back from 2001). It
gives me the error like : ERROR 1067 (42000) at line 48: Invalid default value for ''log_id'' in the statement : CREATE TABLE Log (
log_id int(11) DEFAULT ''0'' NOT NULL auto_increment,
source_id smallint(6) DEFAULT ''0'' NOT NULL,
l_time datetime DEFAULT ''0000-00-00 00:00:00'' NOT NULL,
l_nanos int(11) DEFAULT ''0'' NOT NULL,
l_message text,
PRIMARY KEY (log_id)
); What is this? I am not familiar with mysql, the script is part of
another installation script for the program made in 2001 by the
company that no longer exists. We needed to upgrade the machine the
program was running (redhat 8) to the RedHat ES 4. Now the installation
script gives us this error. Please help.


log_id, l_nanos are INT datatypes.. should be ... DEFAULT 0 ....
note no quotes!!!


<il***********@hotmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...

I am having error trying to run some mysql script (back from 2001). It
gives me the error like :

ERROR 1067 (42000) at line 48: Invalid default value for ''log_id''

in the statement :

CREATE TABLE Log (
log_id int(11) DEFAULT ''0'' NOT NULL auto_increment,
source_id smallint(6) DEFAULT ''0'' NOT NULL,
l_time datetime DEFAULT ''0000-00-00 00:00:00'' NOT NULL,
l_nanos int(11) DEFAULT ''0'' NOT NULL,
l_message text,
PRIMARY KEY (log_id)
);

What is this? I am not familiar with mysql, the script is part of
another installation script for the program made in 2001 by the
company that no longer exists. We needed to upgrade the machine the
program was running (redhat 8) to the RedHat ES 4. Now the installation
script gives us this error.

Please help.



okay! I should try before I reply. Mea culpa!

When I do, I notice that you are declaring a default value of ''0'' for the
auto_increment field [log_id]. No can do in MySQL 4.1x . Come to think of
it, what does a default value in an auto_increment field mean anyway?
Remove "DEFUALT ''0'' " from the log_id line and it works fine.

BTW - I would still check for more text out at line 48 and beyond.
Thomas Bartkus


这篇关于CREATE TABLE出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆