Home > Database > Mysql Tutorial > Why is MyISAM Table Creation Failing with TYPE=MYISAM in MySQL 5.5 ?

Why is MyISAM Table Creation Failing with TYPE=MYISAM in MySQL 5.5 ?

Barbara Streisand
Release: 2024-12-12 22:49:14
Original
822 people have browsed it

Why is MyISAM Table Creation Failing with TYPE=MYISAM in MySQL 5.5 ?

Unable to Create Table with TYPE=MYISAM

When attempting to create a table using the old TYPE syntax, such as:

CREATE TABLE dave_bannedwords(

id INT( 11 ) NOT NULL AUTO_INCREMENT ,
word VARCHAR( 60 ) NOT NULL DEFAULT  '',
PRIMARY KEY ( id ) ,
KEY id( id )
) TYPE = MYISAM ;
Copy after login

You may encounter an error like:

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 'TYPE=MyISAM' at line 6
Copy after login

Solution

As stated in the MySQL documentation for CREATE TABLE Syntax:

"The older TYPE option was synonymous with ENGINE. TYPE was deprecated in MySQL 4.0 and removed in MySQL 5.5. When upgrading to MySQL 5.5 or later, you must convert existing applications that rely on TYPE to use ENGINE instead."

Therefore, replace TYPE with ENGINE to create the table successfully:

CREATE TABLE dave_bannedwords(
  id   INT(11)     NOT NULL AUTO_INCREMENT,
  word VARCHAR(60) NOT NULL DEFAULT '',
  PRIMARY KEY (id),
  KEY id(id) -- this is superfluous in the presence of your PK, ergo unnecessary
) ENGINE = MyISAM ;
Copy after login

The above is the detailed content of Why is MyISAM Table Creation Failing with TYPE=MYISAM in MySQL 5.5 ?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template