mysql控制台常见错误,Mysql控制台解析错误:1064

Hello there!

I know it''s stupid, but when creating a table in a mysql (win32)

database, it won''t let me create this "mytable". Here goes my

ER_PARSE_ERROR.

mysql> CREATE TABLE `mytable` (

-> `mytable_id` int(25) NOT NULL auto_increment,

-> `mytable_title` varchar(100) NOT NULL default '''',

-> `mytable_dts` varchar(25) NOT NULL default '''',

-> `mytable_caption` tinytext NOT NULL,

-> `mytable_full_body` text NOT NULL,

-> PRIMARY KEY (`mytable_id`)

-> ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT=''Testing Full

Text Search Functionality.'';

ERROR 1064: You have an error in your SQL syntax. Check the manual

that corresponds to your MySQL server version for the right syntax to

use near ''DEFAULT CHARSET=latin1 COMMENT=''Testing Full Text Search

Functi

At the same time while inserting a large text as pasted to mysql

console, only couple of lines gets there.

INSERT INTO `mytable` VALUES (1, ''Mozilla Firefox is Cool!'',

''1111813200'', ''Mozilla Firefox blah blah .... more 500 words '');

I guess, the mysql console is limiting the size while inputting. Do I

have to edit that my.cnf file?

Could you please point where am I heading?

mysql> status

--------------

mysql Ver 12.22 Distrib 4.0.20a, for Win95/Win98 (i32)

TIA

--

Raqueeb Hassan

Bangladesh

解决方案

>At the same time while inserting a large text as pasted to mysqlconsole, only couple of lines gets there.

INSERT INTO `mytable` VALUES (1, ''Mozilla Firefox is Cool!'',

''1111813200'', ''Mozilla Firefox blah blah .... more 500 words '');

I guess, the mysql console is limiting the size while inputting. Do I

have to edit that my.cnf file?

A field of type ''text'' is limited to 255 chars, I believe.

It''s not the console limiting you. Try ''longtext''.

Gordon L. Burditt

Gordon Burditt wrote:

A field of type ''text'' is limited to 255 chars, I believe.

That is not true. text field can hold a lot more than that. I have for

example saved html codes of large web pages into text fields.

wi*******@gmail.com wrote:

-> ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT=''Testing Full

"Improved support for character set handling was added to MySQL in

Version 4.1. The features described here are as implemented in MySQL

4.1.1. (MySQL 4.1.0 has some but not all of these features, and some of

them are implemented differently.)"

http://dev.mysql.com/doc/mysql/en/charset.html

If you remove the character set part, it should work (without character

set):

CREATE TABLE `mytable` (

`mytable_id` int(25) NOT NULL auto_increment,

`mytable_title` varchar(100) NOT NULL default '''',

`mytable_dts` varchar(25) NOT NULL default '''',

`mytable_caption` tinytext NOT NULL,

`mytable_full_body` text NOT NULL,

PRIMARY KEY (`mytable_id`)

) ENGINE=MyISAM COMMENT=''Testing Full

Text Search Functionality.'';

At the same time while inserting a large text as pasted to mysql

console, only couple of lines gets there.

INSERT INTO `mytable` VALUES (1, ''Mozilla Firefox is Cool!'',

''1111813200'', ''Mozilla Firefox blah blah .... more 500 words '');

I guess, the mysql console is limiting the size while inputting. Do I

have to edit that my.cnf file?

When I insert large amounts of data to database I often save the insert

queries into file and then call:

mysql -u username -p databasename < queryfile.sql

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值