ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your_第1张图片上去这条sql语句确实没毛病,但是运行起来就是报错
ERROR 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 ‘DATE,
PRIMARY KEY ( runoob_id )
)ENGINE=InnoDB DEFAULT CHARSET=utf8’ at line 5
遇到这种情况的时候,尝试了各种办法始终无法解决,最后在MySQL语法上终于找到了解决办法,在MySQL中,为了区分MySQL的关键字与普通字符,MySQL引入了一个反引号。
详情见:https://dev.mysql.com/doc/refman/5.5/en/keywords.html

修改过后
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your_第2张图片
在这发现有一个警告;使用show warnings进行查看错误
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your_第3张图片
Warning | 3719 | ‘utf8’ is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
原来在MySQL8.0中utf8目前是字符集UTF8MB3的别名,但将在未来的版本中成为UTF8MB4的别名。为避免歧义,请考虑使用UTF8MB4。

最后讲数据表中utf8修改为utf8mb4即可
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your_第4张图片

你可能感兴趣的:(数据库,mysql,bug)