Ealsen. 2022-10-10 18:23 采纳率: 80%
浏览 67
已结题

mysql创建数据表出错1064

mysql> use student2018;
Database changed
mysql> CREATE TABLE class1801
(
序号 INT,
学号 CHAR(8),
姓名 VARCHAR(30),
性别 CHAR(2),
出生日期 TIME,
专业 VARCHAR(20),
备注 TEXT
);
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 '��号 INT,
学号 CHAR(8),
姓名 VARCHAR(30),
' at line 3
mysql> create database student default charset utf8;
Query OK, 1 row affected (0.00 sec)

mysql> CREATE TABLE class1801
(
序号 INT,
学号 CHAR(8),
姓名 VARCHAR(30),
性别 CHAR(2),
出生日期 TIME,
专业 VARCHAR(20),
备注 TEXT
);
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 '��号 INT,
学号 CHAR(8),
姓名 VARCHAR(30),
' at line 3
mysql> CREATE TABLE class1801
(
序号 INT,
学号 CHAR(8),
姓名 VARCHAR(30),
性别 CHAR(2),);
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 '��号 INT,
学号 CHAR(8),
姓名 VARCHAR(30),
' at line 3
mysql> CREATE TABLE class1801
(
序号 INT,
);
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 '��号 INT,
)' at line 3
mysql> CREATE TABLE class1801
(
序号 INT);
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 '��号 INT)' at line 3
mysql>
mysql>
mysql>
mysql>
mysql>

这是出什么问题了,在其他电脑上都能创建的

img

  • 写回答

4条回答 默认 最新

  • 心寒丶 全栈领域优质创作者 2022-10-10 18:31
    关注

    中文格式乱码导致的吧,执行这些
    SET character_set_client = utf8;
    SET character_set_results = utf8;
    SET character_set_connection = utf8;
    不行就换英文看看

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
查看更多回答(3条)

报告相同问题?

问题事件

  • 系统已结题 10月18日
  • 已采纳回答 10月10日
  • 修改了问题 10月10日
  • 创建了问题 10月10日