How to Fix the Error 1064 mysql 42000

The “1064 mysql 42000” error occurs in MYSQL whenever you have named your database with an unacceptable name.

There are two ways you can name a database in MYSQL.

1. Without using backticks

In MySQL, you can create a database without enclosing its name in backticks. Here is an example:

mysql> create database employees-US 

This will give an error since hyphens are not acceptable. You can rename the database to:

mysql> create database USemployees

2. Using Backticks

If you wish to include characters such as hyphens in your database name, enclose the name of the table within backticks as shown below:

mysql> create database `employees-US` 

This will not return an error, and your database will be created successfully.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved