[Err] 1064 - 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 ''<h1 style="text-align: center;">php
[Err] 1064 - 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 ''<h1 style="text-align: center;">php实现 字符串分割</h' at line 1
一、总结
一句话总结:我本来都是直接打开sql复制里面的内容到mysql中执行,这次是用nodepad++,所以出错。这不是错误,1064是语法错误。
二、[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL s
[Err] 1064 - 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 at line 3
MySQL 5.6,Navicat For MySQL 10.0.10 中执行SQL语句时提示此错误,在CMD中执行SQL文件中的语句时提示以下错误:
D:\Users\Aven>mysql -uroot -p < F:\Publish\Data\share_update.sql
Warning: Using a password on the command line interface can be insecure.
ERROR 1064 (42000) at line 4: You have an error in your SQL syntax; check the ma
nual that corresponds to your MySQL server version for the right syntax to use n
ear 'ALTER聽TABLE聽mcu聽CHANGE聽`LOCAL_ID`聽`LOCAL_ID`聽VARCHAR(50)聽'
at line 1
解决方案:
发现解决该问题的关键,是错误提示中的空格都是“聽”,这让我想到是文件的编码问题,然后做文件编码的转换。
推荐使用Notepad++,编码转换非常方便,如图:
转换为UTF-8格式,问题依旧,再转为ANSI格式试试:
哈哈,原形毕露了吧!把?都替换为空格,保存,再执行,一切OK了。
反思:
为什么会出现这种问题呢?
这些语句是从QQ复制到Word中,又从Word中复制到Notepad++中,
估计是从QQ或Word中复制出来的空格有问题。
三、完美解决 ERROR 1064 (42000): You have an error in your SQL syntax ... near …
在MySQL命令行使用sql语句进行建表时,MySQL 报错,这个问题之前遇到过几次,但是总是会因为疏忽又相遇,今天把这个问题写出来,加深印象吧。
sql语句:
CREATE TABLE 'lrs_audit_rule_package'(
'id' BIGINT(20) AUTO_INCREMENT PRIMARY KEY COMMENT '主键',
'package_code' varchar(6) NOT NULL COMMENT '规则包',
'package_type' varchar(2) NOT NULL COMMENT '规则包类型',
'package_desc' varchar(100) COMMENT '描述',
'create_time' datetime DEFAULT NULL COMMENT '创始时间',
'modified_time' datetime DEFAULT NULL COMMENT '修改时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='审核规则包';
看上去这条sql语句确实没毛病,但是运行起来就是报错
报错信息:
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 ''lrs_audit_rule_package'(
'id' BIGINT(20) AUTO_INCREMENT PRIMARY KEY COMMENT ' at line 1
其实这个问题就是语法上的错误,在MySQL中,为了区分MySQL的关键字与普通字符,MySQL引入了一个反引号。
详情见:https://dev.mysql.com/doc/refman/5.5/en/keywords.html
在上述的sql语句中,列名称使用的是单引号而不是反引号,所以会就报了这个错误出来。修改后
CREATE TABLE `lrs_audit_rule_package`(
`id` BIGINT(20) AUTO_INCREMENT PRIMARY KEY COMMENT '主键',
`package_code` varchar(6) NOT NULL COMMENT '规则包',
`package_type` varchar(2) NOT NULL COMMENT '规则包类型',
`package_desc` varchar(100) COMMENT '描述',
`create_time` datetime DEFAULT NULL COMMENT '创始时间',
`modified_time` datetime DEFAULT NULL COMMENT '修改时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='审核规则包';
再次运行就不会报错了,但是有一点需要注意,后面列的注释不能用反引号,因为这只是一个普通字符串,不是MySQL的关键字。
在英文键盘输入环境下,按图示按钮输入反引号 `
[Err] 1064 - 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 ''<h1 style="text-align: center;">php的更多相关文章
- MySql 执行语句错误 Err] 1064 - 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
关于用Power Designer 生成sql文件出现 错误 [Err] 1064 - You have an error in your SQL syntax; check the manual ...
- 插入mysql语句报错:1064 - 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
插入一个很简单的sql语句时候,mysql一直报错: [SQL] INSERT INTO ORDER ( id, activity_id, order_type, phone, order_amoun ...
- 1064 - 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 'groups)VALUES('1','hh','hh@163.com','Boss')' at line 1
mysql8.0版本 在已存在的表里插入一条数据 insert INTO api_user(id,username,email,groups)VALUES('1','hh','hh@163.com', ...
- 解决ROR 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 'creat table study_record( id int(11) not null
之前一直用的好好的,突然就出现了这个错误: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual tha ...
- ERROR: 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=InnoDB' at line 7
问题: 使用hibernate4.1.1,数据库使用mysql5.1.30,使用hibernate自动生成数据库表时,hibernate方言使用org.hibernate.dialect.MySQLI ...
- C# Mysql 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 ????
有几年没用过MySql数据了,今天在使用C#访问MySql数据库时出现了一个小插曲. 错误提示: You have an error in your SQL syntax; check the man ...
- 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 '
mysql中如果字段使用了关键字,在插入和更新时会提示 You have an error in your SQL syntax; check the manual that corresponds ...
- MySQLSyntaxErrorException: 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 ...
下面是我update数据库时打印出来的异常: ### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSynt ...
- 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 'like '%逸%'' at line 1
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-/ ...
随机推荐
- 学习《Python数据科学手册》高清中文PDF+高清英文PDF+代码
如果有一定的数据分析与机器学习理论与实践基础,<Python数据科学手册>这本书是绝佳选择. 是对以数据深度需求为中心的科学.研究以及针对计算和统计方法的参考书.很友好实用,结构很清晰.但 ...
- 【editplus经常用的快捷键】Editplus 选中一行ctrl+r,Edit 合并行 Ctrl+Shift+J 合并选定行 删除当前行
Editplus 选中一行: ctrl+rEditplus 复制一行: ctrl+r选择行,然后ctrl+c复制.复制一行到下一行中:Editplus有:Ctrl+j 复制上一行的一个字符到当前行Ed ...
- [Python] Execute a Python Script
Python scripts can be executed by passing the script name to the python command or created as execut ...
- php 图片局部打马赛克
php 图片局部打马赛克 原理: 对图片中选定区域的每一像素,添加若干宽度及高度,生成矩型.而每一像素的矩型重叠在一起.就形成了马赛克效果. 本例使用GD库的imagecolorat获取像素颜色,使用 ...
- vim插件之ack
这个插件其实是实现vim内部搜索功能的今天在学习vim搜索的时候,遇到了一个ack.vim的插件,这个插件给我们提供了一个并行于系统命令grep的搜索命令Ack 它的下载地址是 https://git ...
- C#变量的作用域
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- Kinect 开发 —— 深度信息
转自:http://www.cnblogs.com/yangecnu/archive/2012/04/04/KinectSDK_Depth_Image_Processing_Part1.html 深度 ...
- HDU 6182 A Math
A Math Problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)To ...
- spark源码阅读
根据spark2.2的编译顺序来确定源码阅读顺序,只阅读核心的基本部分. 1.common目录 ①Tags②Sketch③Networking④Shuffle Streaming Service⑤Un ...
- JS面向对象:
面向对象:--JS系统对象也是基于原型的程序--不要修改或者添加系统对象下面的方法和属性eg: var arr = [1,2,3]; Array.prototype.push = function() ...