简体   繁体   中英

#1064 error in MySQL. utf8_general_ci with MRG_MYISAM engine

I want create a database server online but i have a problem. My code is this:

CREATE TABLE `b10_16569036_frontonApp`.`fronton` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`Name` VARCHAR CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`number` INT NOT NULL ,
`cover` INT NOT NULL ,
`ligth` INT NOT NULL ,
`type` INT NOT NULL ,
`height` FLOAT NULL DEFAULT NULL ,
`widht` FLOAT NULL DEFAULT NULL ,
`lenght` FLOAT NULL DEFAULT NULL ,
`latitude` DOUBLE NOT NULL ,
`longitude` DOUBLE NOT NULL ,
`status` INT NOT NULL DEFAULT '0',
`time` INT NOT NULL DEFAULT NULL ,
`price` INT NOT NULL DEFAULT '0'
) ENGINE = MRG_MYISAM CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

But when I apply this code, this error appear:

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 'CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, number INT NOT NULL, `cov' at line 1

I suppose that it is about utf8 and MRG_MYISAM engine but, what character set can i use? and what is the difference between utf8 and others?

i'm using phpMyAdmin to create this database.

Thank you so much!

You need to give a limit for varchar . Change

Name VARCHAR CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,

to

Name VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,

You can change the limit asper your requirement. I have taken 100 for example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM