Home

How do you fix a MySQL error code 1064?

Alton Alexander
By Alton AlexanderUpdated on June 4th, 2022

MySQL error code 1064 is a syntax error. This error code happens when the MySQL parser encounters an invalid character while parsing a SQL statement.

Users typically search for a solution by asking about:

  • error code 1064 mysql workbench
  • mysql error code 1064

1. Check your SQL syntax for errors

The steps to check your SQL syntax for errors in order to fix mysql error code 1064 are as follows:

  1. Verify that your SQL statements are properly formed and correctly punctuated.
  2. Verify that your SQL commands are properly executed.
  3. Check for syntax errors in yourSQL statements.
  4. If errors are found, correct them and re-execute the SQL commands.

2. If you are using MySQL version 5.7.4 or higher, use the INNODB_STRICT_MODE option

  1. Use the mysql command to get the current error code: mysql> show error status;
  2. To set the INNODB_STRICT_MODE option, use the following command: mysql> set global innodb_strict_mode=1;
  3. To restart MySQL, use the following command: mysql> restart;

3. If you are using MySQL version 5.6.4 or lower, recreate your tables using the InnoDB engine

To recreate your tables using the InnoDB engine in order to fix mysql error code 1064, follow these steps:

  1. Log in to your MySQL server.
  2. Use the mysqladmin command to create a new database and enter the database name.
  3. Use the mysqladmin command to create a new table.
  4. Use the mysqladmin command to create a new table column.
  5. Use the mysqladmin command to create a new table row.
  6. Use the mysqladmin command to insert data into the newly created table.
  7. Use the mysqladmin command to issue the mysql command to check the result of your work. If you are using MySQL version 5.6.4 or lower, you will need to use the InnoDB engine to recreate your tables. If you are using MySQL version 7.0.3 or higher, you will not need to use the InnoDB engine to recreate your tables.

4. Check your operating system settings for maximum allowed open files

  1. Open a command prompt and change to your MySQL installation directory
  2. Issue the following command to get a list of all open files on your system

file -list open

  1. Use the following command to set a maximum allowed number of open files for MySQL

mysqld --max-open-files=128000000

Some users might also have success with the following opitons:

  1. Increase the amount of memory available to MySQL.
  2. If you are using MySQL version 5.7.8 or higher, use the new JSON data type.