我在ubuntu下安装joomla的时候出的问题,请问一下为什么?

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 'TYPE=MyISAM CHARACTER SET utf8' at line 29 SQL=CREATE TABLE jos_banner ( bid int(11) NOT NULL auto_increment, cid int(11) NOT NULL default '0', type varchar(30) NOT NULL default 'banner', name varchar(255) NOT NULL default '', alias varchar(255) NOT NULL default '', imptotal int(11) NOT NULL default '0', impmade int(11) NOT NULL default '0', clicks int(11) NOT NULL default '0', imageurl varchar(100) NOT NULL default '', clickurl varchar(200) NOT NULL default '', date datetime default NULL, showBanner tinyint(1) NOT NULL default '0', checked_out tinyint(1) NOT NULL default '0', checked_out_time datetime NOT NULL default '0000-00-00 00:00:00', editor varchar(50) default NULL, custombannercode text, catid INTEGER UNSIGNED NOT NULL DEFAULT 0, description TEXT NOT NULL DEFAULT '', sticky TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, ordering INTEGER NOT NULL DEFAULT 0, publish_up datetime NOT NULL default '0000-00-00 00:00:00', publish_down datetime NOT NULL default '0000-00-00 00:00:00', tags TEXT NOT NULL DEFAULT '', params TEXT NOT NULL DEFAULT '', PRIMARY KEY (bid), KEY viewbanner (showBanner), INDEX idx_banner_catid(catid) ) TYPE=MyISAM CHARACTER SET utf8

1个回答

很显然,抛出错误时MySQL执行的并不是你给出的这一句SQL。有可能是你在"外调"(楼主你在另一个帖子中的说法)时写错了保存SQL查询语句的变量。

可以echo一下你的sql语句,有可能是内容字段的值中包含sql中有特殊用途的符号,如英文半角单引号“''”(内容中的html标签属性值的引号会导致这样的错误)

语法错误,检查near后面的部分

关于You have an error in your SQL syntax; check the manual that corresponds..的解决
代码如下:
  pstmt = conn.prepareStatement("insert into column(columnTitle) values( )"); pstmt.setString(1, column.getColumnTitle());

执行这个插入语句的时候,出现以下错误信息:
  引用
  
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 'column(columnTitle) values(' ¨±  …  ')' at line 1

一直把问题定位为插入语句的语法有问题,查找的时候也是往这个方向查,以至于对于网上说的”关键字引用错误”之类的解决方法直接无视,19x19 后来终于看到有个同学跟我用了同样一个关键字“column”作为表名,问题解决,呃~为了防止再犯这样的错误,贴上mysql关键字列表:
ADD ALL ALTER
ANALYZE AND AS
ASC ASENSITIVE BEFORE
BETWEEN BIGINT BINARY
BLOB BOTH BY
CALL CASCADE CASE
CHANGE CHAR CHARACTER
CHECK COLLATE COLUMN
CONDITION CONNECTION CONSTRAINT
CONTINUE CONVERT CREATE
CROSS CURRENT_DATE CURRENT_TIME
CURRENT_TIMESTAMP CURRENT_USER CURSOR
DATABASE DATABASES DAY_HOUR
DAY_MICROSECOND DAY_MINUTE DAY_SECOND
DEC DECIMAL DECLARE
DEFAULT DELAYED DELETE
DESC DESCRIBE DETERMINISTIC
DISTINCT DISTINCTROW DIV
DOUBLE DROP DUAL
EACH ELSE ELSEIF
ENCLOSED ESCAPED EXISTS
EXIT EXPLAIN FALSE
FETCH FLOAT FLOAT4
FLOAT8 FOR FORCE
FOREIGN FROM FULLTEXT
GOTO GRANT GROUP
HAVING HIGH_PRIORITY HOUR_MICROSECOND
HOUR_MINUTE HOUR_SECOND IF
IGNORE IN INDEX
INFILE INNER INOUT
INSENSITIVE INSERT INT
INT1 INT2 INT3
INT4 INT8 INTEGER
INTERVAL INTO IS
ITERATE JOIN KEY
KEYS KILL LABEL
LEADING LEAVE LEFT
LIKE LIMIT LINEAR
LINES LOAD LOCALTIME
LOCALTIMESTAMP LOCK LONG
LONGBLOB LONGTEXT LOOP
LOW_PRIORITY MATCH MEDIUMBLOB
MEDIUMINT MEDIUMTEXT MIDDLEINT
MINUTE_MICROSECOND MINUTE_SECOND MOD
MODIFIES NATURAL NOT
NO_WRITE_TO_BINLOG NULL NUMERIC
ON OPTIMIZE OPTION
OPTIONALLY OR ORDER
OUT OUTER OUTFILE
PRECISION PRIMARY PROCEDURE
PURGE RAID0 RANGE
READ READS REAL
REFERENCES REGEXP RELEASE
RENAME REPEAT REPLACE
REQUIRE RESTRICT RETURN
REVOKE RIGHT RLIKE
SCHEMA SCHEMAS SECOND_MICROSECOND
SELECT SENSITIVE SEPARATOR
SET SHOW SMALLINT
SPATIAL SPECIFIC SQL
SQLEXCEPTION SQLSTATE SQLWARNING
SQL_BIG_RESULT SQL_CALC_FOUND_ROWS SQL_SMALL_RESULT
SSL STARTING STRAIGHT_JOIN
TABLE TERMINATED THEN
TINYBLOB TINYINT TINYTEXT
TO TRAILING TRIGGER
TRUE UNDO UNION
UNIQUE UNLOCK UNSIGNED
UPDATE USAGE USE
USING UTC_DATE UTC_TIME
UTC_TIMESTAMP VALUES VARBINARY
VARCHAR VARCHARACTER VARYING
WHEN WHERE WHILE
WITH WRITE X509
XOR YEAR_MONTH ZEROFILL

如果回答对您有帮助,请采纳

ishiharashuichi
ishiharashuichi 回复wolf094014: 谢谢!
接近 5 年之前 回复
u012216727
大河行脚 回复ishiharashuichi: 我嫌麻烦,所以没有写文章链接,而是黏贴过来的,这也省了你麻烦;既然说是你数据库的问题你可以检查一下你的数据库
接近 5 年之前 回复
ishiharashuichi
ishiharashuichi 还有,您一定是记错了.我刚刚用csdn没几天,这是第一个帖子,请问一下"外调"是什么意思
接近 5 年之前 回复
ishiharashuichi
ishiharashuichi 安装时只是用了一下phpmyadmin
接近 5 年之前 回复
ishiharashuichi
ishiharashuichi 谢谢你,本人菜鸟一枚,敢问大仙,我是在Firefox用localhost安装时出的问题.请问一下,这个sql命令在哪里找呢?
接近 5 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问