Home >Database >Mysql Tutorial >Why Am I Getting a '1064 Error in CREATE TABLE ... TYPE=MYISAM' in MySQL?

Why Am I Getting a '1064 Error in CREATE TABLE ... TYPE=MYISAM' in MySQL?

Barbara Streisand
Barbara StreisandOriginal
2024-12-25 13:27:59411browse

Why Am I Getting a

Troubleshooting "1064 Error in CREATE TABLE ... TYPE=MYISAM"

When creating a table in MySQL using the deprecated TYPE=MYISAM syntax, users may encounter a "1064 error in SQL syntax." This error stems from the gradual phase-out of the TYPE option in favor of the more versatile ENGINE keyword.

Resolution:

As per the MySQL documentation, starting with version 5.5, the use of TYPE has been deprecated and removed. Applications that previously relied on TYPE must be modified to utilize ENGINE instead.

Therefore, to resolve this error, the CREATE TABLE statement should be updated to include the ENGINE keyword, as shown below:

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 ;

This revised statement will successfully create the table in MySQL 5.5 or later versions, eliminating the "1064 error in SQL syntax."

The above is the detailed content of Why Am I Getting a '1064 Error in CREATE TABLE ... TYPE=MYISAM' in MySQL?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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