网站备案登录,wordpress 侧栏主题,网站建设成本预测表,东营建设信息网网站前几天帮同事解决一个案例#xff0c;在主从复制环境下#xff0c;从库上的MySQL版本号是5.5.5#xff0c;遇到下面的错误#xff1a;~~~#其他非相关信息我都隐藏掉了[(yejrimysql.com)] show slave status \G;Slave_IO_Running: YesSlave_SQL_Running: NoLast_Errno: …前几天帮同事解决一个案例在主从复制环境下从库上的MySQL版本号是5.5.5遇到下面的错误~~~#其他非相关信息我都隐藏掉了[(yejrimysql.com)] show slave status \G;Slave_IO_Running: YesSlave_SQL_Running: NoLast_Errno: 1064Last_Error: 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 6e86db84_14847168f19__8000 at line 1 on query. Default database: act. Query: SAVEPOINT 6e86db84_14847168f19__8000Last_IO_Errno: 0Last_IO_Error:Last_SQL_Errno: 1064Last_SQL_Error: 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 6e86db84_14847168f19__8000 at line 1 on query. Default database: act_log. Query: SAVEPOINT 6e86db84_14847168f19__8000~~~第一感觉是遇到保留关键字了不过看到这么长的字符串不应该是保留关键字才对。经过尝试最后发现是字符串中的 “e” 这个字符如果存在就可能会报错看起来应该是bug才对了。在MySQL的bug系统里确实找到了这个bug不过看bug描述在5.5版本中应该是已经修复了才对看来太不靠谱了呀~~关于这个bug[Savepoint identifier is occasionally considered as floating point numbers](http://bugs.mysql.com/bug.php?id55962 Savepoint identifier is occasionally considered as floating point numbers)其实除了升级版本外解决方法也很简单把savepoint后面的 identifier 字符串用反引号(波浪号的下档键英文叫做 backticks 键)引用起来就行。例如~~~savepoint 6e86db84_14847168f19__8000;~~~这样就可以了。这个案例也提示我们在写SQL时涉及到数据库、表、字段、identifier 等名称时最好是都能用反引号引用确保可用。曾经看到线上数据表有个字段名是 check 这个名字在MySQL里很早就已经是保留关键字幸好开发同学比较靠谱都加上了反引号。关于savepoint的2个bug[Savepoint Identifier should be enclosed with backticks](http://bugs.mysql.com/bug.php?id55961 Savepoint Identifier should be enclosed with backticks)[Savepoint identifier is occasionally considered as floating point numbers](http://bugs.mysql.com/bug.php?id55962 Savepoint identifier is occasionally considered as floating point numbers)