简体   繁体   English

ubuntu命令行上的SQL错误

[英]SQL error on ubuntu command line

I am working with a SQL database on a Ubuntu LAMP server. 我在Ubuntu LAMP服务器上使用SQL数据库。 I am attempting to create a new database then a new table in it, which can hold blob s. 我正在尝试创建一个新数据库,然后在其中创建一个新表,该表可以容纳blob I can login, create my database, use it, but then I cannot create the table. 我可以登录,创建我的数据库,使用它,但是之后我无法创建该表。 I am doing: 我在做:

$mysql -u root -p mypass
mysql> use frame;
Database changed
mysql> create table 'frame_info' ( 'frame_data' BLOB NOT NULL, 'frame_name' VARCHAR(45) NULL, 'creator_name' VARCHAR(45) NULL, PRIMARY KEY ('frame_data'));

From there, I get the error: 从那里,我得到错误:

ERROR 1064 (4200): You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to user near ''fram
e_info' ( create table 'frame_info' ( 'frame_data' BLOB NOT NULL, 'frame_na' at 
line 1

Obviously that error is truncated by the mysql display, but you get the gist. 显然,该错误已被mysql显示所截断,但您得到了要点。

You should use backticks ` instead of single quotes ' or (in your case) you can succeed without them at all : 您应该使用反引号`而不是单引号'或者(在您的情况下)完全可以不用反引号而成功:

 create table `frame_info` (
     `frame_data` BLOB NOT NULL,
     `frame_name` VARCHAR(45) NULL,
     `creator_name` VARCHAR(45) NULL,
      PRIMARY KEY (`frame_data`)
 );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM