The ERROR 1064 (42000) mainly occurs when the syntax isn’t set correctly i.e. error in applying the backtick symbol or while creating a database without them can also create an error, if you will use hyphen in the name, for example, Demo-Table will result in ERROR 1064 (42000).
To remove the error, you need to use backtick around the database name properly or use nothing. Following is the syntax wherein we haven’t used the backtick. This works correctly −
create database yourDatabaseName;
Since adding hyhen to the database name will result in an error. Let us implement it while creating the database name −
mysql> create database customer-tracker;
This will produce the following error since we used hyphen in the database name, which isn’t acceptable −
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-tracker' at line 1
Still, we can fix the hyphen in the database name by surrounding the name with backtick symbol −
mysql> create database `customer-tracker`;
This will produce the following output −
Query OK, 1 row affected (0.21 sec)
Now database is created successfully.