最近写毕设做实验,遇到一个数据库的问题,困扰了好几天,终于在今天尝试解决了,虽然问题很简答,但必须要记录一下!
脚本
CREATE TABLE groups (
`id` int(10) unsigned NOT NULL DEFAULT 0,
`orgid` int(10) unsigned NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`adminuid` int(10) unsigned NOT NULL,
`category` enum('alumni_admin_public','rackmgr_admin_rackset','rackmgr_general_rackset','rbs_admin_room') COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--插入,报错就在下边
INSERT INTO groups (id,orgid,name,adminuid,category) VALUES
(67,70,'信息学部机架组副手',15750,'rackmgr_admin_rackset'),
(68,70,'信息学部机架组助手',15750,'rackmgr_general_rackset');
问题
报错:
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 (id,orgid,name,adminuid,category) VALUES
(67,70,'信息学部机架组å' at line 1, Time: 0.000000s
解决方法
group添加转义符,变为 `group`