0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

create databaseするとERROR 1064 (42000): You have an error in your SQL syntax;とエラーが出る

Posted at

エラー発生経緯

EC2にMariaDBをインストールして、早速データベースを作ろうとコマンドを打ったところ、エラーが出たので対処法を備忘録として残します。

最初に打ち込んだコマンドが以下。

create database データベース名;

これに対して出た出力結果が以下の通り。

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'データベース名' at line 1

解決方法

ただデータベース名をバッククォートで囲むだけでいけました。

create database `データベース名`;

シングルクォートではないのでご注意を。

原因

名前にハイフンが含まれるテーブルやデータベースを作成しようとした場合にはこのエラーが出るようです。
ハイフン付きのテーブルやデータベースを作成する時はご注意を。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?