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