在Mysql建表时,使用create 语句,如:’mysql> create database test1;‘,Mysql报错: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 'database test1' at line 1
上网查是语法错误,当你输入语句没有加分号就enter,Mysql不会报错,但你在后面输入正确的命令,Mysql会把两条语句当成一条执行,如,‘ create database test1 create database test1;’,就会报错。在报错后再次输入正确的创建命令就可以了。
but,我发现并没有什么用,还是会报: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 'database test1' at line 1
解决:
mysql> create
-> database
-> test1
-> ;
显示:
Query OK, 1 row affected (0.01 sec)
建表成功!
我觉得是我空格键的问题,还在研究中。。
本文详细解析了在MySQL中创建数据库时遇到的ERROR1064(42000)语法错误,提供了正确的创建语句格式,并分享了一个有效解决方法,即正确使用多行输入和分号。
5096

被折叠的 条评论
为什么被折叠?



