MySQL1064 error is one of the common errors in MySQL database, mainly caused by syntax errors in SQL statements. In MySQL, SQL statements are the core language used to query and operate the database. If there are errors in the SQL statements, a 1064 error will be thrown.
In this article, we will introduce the causes and solutions of the MySQL 1064 error, and help readers understand how to prevent and repair this error in MySQL.
1. Causes of MySQL 1064 error
For example:
SELECT FROM users WHERE user_id=1;
The error is that the SELECT statement is missing the field to be queried. It should be changed to:
SELECT username FROM users WHERE user_id=1;
For example:
CREATE TABLE t1 (id INT PRIMARY KEY, name VARCHAR(60)) ENGINE=MyISAM DEFAULT CHARSET=utf8;
For example:
CREATE TABLE t1 (id INT PRIMARY KEY, name VARCHAR(60), id INT);
The id column is defined twice and should be changed to:
CREATE TABLE t1 (id INT PRIMARY KEY, name VARCHAR(60), age INT);
2. Solve the MySQL 1064 error
Summary
MySQL 1064 error is one of the common errors in MySQL. It is usually caused by syntax errors in SQL statements. This article explains what may cause the MySQL1064 error, and how to prevent and fix it. When using MySQL, checking the duplication of SQL statements, database engines, and names is key to avoiding 1064 errors. Hope this article is helpful to readers.
The above is the detailed content of How to solve mysql 1064 error. For more information, please follow other related articles on the PHP Chinese website!