Home > Database > Mysql Tutorial > MySQL Error 1064: Why Is My CREATE TABLE Statement Failing, and How Can I Fix It?

MySQL Error 1064: Why Is My CREATE TABLE Statement Failing, and How Can I Fix It?

Patricia Arquette
Release: 2024-12-15 10:06:16
Original
172 people have browsed it

MySQL Error 1064: Why Is My CREATE TABLE Statement Failing, and How Can I Fix It?

Frustrating MySQL CREATE TABLE Error: Error 1064

While attempting to create a table, you may encounter the perplexing error 1064. Let's explore the cause and provide a solution for this issue.

The error message indicates a syntax error in the CREATE TABLE statement. Specifically, MySQL no longer supports the TYPE option, which has been deprecated and removed in subsequent versions.

Cause

The legacy TYPE option was equivalent to the current ENGINE option. MySQL has removed support for TYPE to promote consistency and streamline the syntax for defining table storage engines.

Solution

To resolve this issue, replace the outdated TYPE option with the appropriate ENGINE option. For instance, to create a table using the MyISAM storage engine:

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

By adhering to the current syntax, you can successfully create the desired table without encountering the TYPE-related error.

The above is the detailed content of MySQL Error 1064: Why Is My CREATE TABLE Statement Failing, and How Can I Fix It?. 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