
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
Fix ERROR 1064 (42000) while creating a database in MySQL?
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.
- Related Articles
- Fix MySQL Database Error #1064?
- Resolve MySQL ERROR 1064 (42000): You have an error in your syntax?
- Fix Error in MySQL syntax while creating a table column with name “index”?
- Fix MySQL ERROR 1064 (42000) check the manual that corresponds to your MySQL server version for the right syntax to use near ')'
- Fix MySQL Error #1064 - You have an error in your SQL syntax… near 'TYPE=MyISAM?
- ERROR 1064 (42000): You have an error in your SQL syntax at zero fill column?
- Resolve ERROR 1064 (42000) that occurred after using varchar (without providing the size)
- Fix MySQL ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key
- Error while creating a PO in SAP system from a .NET application
- Creating and Using a MySQL Database
- Creating and Selecting a MySQL Database
- Resolve usage of quotes 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?
- How to correctly use INSERT INTO … SELECT in MySQL to avoid Error 1064?
- Fix Error with TYPE=HEAP for temporary tables in MySQL?
- Fix Drop table view #1051 unknown table error in MySQL
