MySQL Error 1064: Syntax Mismatch in XAMPP
When attempting to execute queries that add foreign key constraints or indexes in a MySQL database using the XAMPP control panel, some users may encounter Error 1064, indicating a syntax issue. This error is often accompanied by the message "You have an error in your SQL syntax; check the manual...".
Upon closer examination, it is discovered that the problem lies with the use of the "VISIBLE" keyword when adding an index in the SQL statement. By removing the "VISIBLE" keyword, the query executes successfully.
Underlying Cause: Differences in MariaDB Syntax
XAMPP uses MariaDB as its default database server, which has its own unique syntax for certain operations. The "VISIBLE" keyword is not supported in MariaDB, and its inclusion in the SQL statement can lead to syntax errors.
Resolution:
To resolve this issue and avoid similar errors in the future, it is important to be aware of the syntax differences between MySQL and MariaDB. When using XAMPP with MariaDB, it is recommended to refer to the specific syntax documentation for MariaDB to avoid potential syntax errors.
Additionally, the MariaDB project has its own bug tracking system where you can report and track issues. For this specific case, the issue is documented in the MariaDB Issue Tracker (MDEV-7317), providing further details and the expected timeline for its resolution.
The above is the detailed content of Why Am I Getting MySQL Error 1064 in XAMPP When Adding Indexes?. For more information, please follow other related articles on the PHP Chinese website!