MySql 建表出现的问题 : [ERR] 1064 - You have an error in your SQL syntax; check the manual.......


使用 MySql 建表出现的问题

  • 在使用 Navicat Premium 运行 sql 语句进行建表时,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 ''id') ) 
建表语句:
DROP DATABASE IF EXISTS javaweb;
CREATE DATABASE javaweb DEFAULT CHARACTER SET utf8;
USE javaweb;

CREATE TABLE user(   
    id int primary key auto_increment,
    name varchar(20) not null,
    gender varchar(5),
    age int,
    address varchar(32),
    qq    varchar(20),
    email varchar(50),
    username varchar(32),
    password varchar(32)
);

出现错误提示
[ERR] 1064 - You have an error in your SQL syntax; check the manual.......

此问题是 MySql 语法上的错误,在 MySQL 中,为了区分 MySQL 的关键字与普通字符,MySQL 引入了一个反引号。

在上述的 sql 语句中,列名称没有使用反引号或者列名称使用单引号,都会报这个错误出来

反单引号位置:不管什么输入法,切换到英文状态下,左上角Esc键下边,Tab键上边,数字1键左边那个就可以打出反引号,中文状态下是一个小圆点。

DROP DATABASE IF EXISTS javaweb;
CREATE DATABASE javaweb DEFAULT CHARACTER SET utf8;
USE javaweb;

CREATE TABLE user(   
    `id` int primary key auto_increment,
    `name` varchar(20) not null,
    `gender` varchar(5),
    `age` int,
    `address` varchar(32),
    `qq`    varchar(20),
    `email` varchar(50),
    `username` varchar(32),
    `password` varchar(32)
);

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



猜您在找 修改mysql密码出现报错:ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corres Python操作mysql数据库出现pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check MySQL错误[ERR] 1064 - You have an error in your SQL syntax; 【报错】ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds t 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 '11. set password for 'root'@'localhost' 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 【异常】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 '"order"' at line 1 SQL语句报错:You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 报错--->java.sql.SQLSyntaxErrorException: 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 'delect from testd MySql 执行语句错误:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to usenear 'bookName like '%Java%'' at line 1
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM