简体   繁体   English

.sql导入phpMyAdmin数据库时出错

[英]error while importing .sql to phpMyAdmin db

I want to import an SQL file to my phpMyAdmin database, the file contains tables about a restaurant application and a table about the admin login, but I have 2 unexpected errors, I really don't see what is exactly wrong with that?. 我想将一个SQL文件导入到我的phpMyAdmin数据库中,该文件包含有关餐厅应用程序的表和有关管理员登录的表,但是我有2个意外错误,我真的看不出这到底有什么问题?。 here is the error message: 这是错误消息:

2 errors were found during analysis.

An opening bracket followed by a set of values was expected. (near "CREATE" at position 109)
Unexpected token. (near "CREATE" at position 109)
SQL query:

INSERT INTO `adminlogin` (`id`, `Username`, `Password`, `right`) VALUES (1, 'admin@gmail.com', '123', 1), CREATE TABLE IF NOT EXISTS `tbl_food` ( `id` int(11) NOT NULL AUTO_INCREMENT, `food_type` varchar(50) NOT NULL, `food_id` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1

MySQL said: Documentation

#1064 - 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 'CREATE TABLE IF NOT EXISTS `tbl_food` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
' at line 6

and here is the two tables that show errors. 这是显示错误的两个表。 Any insight on that? 有什么见解吗? thank you 谢谢

CREATE TABLE IF NOT EXISTS `adminlogin` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Username` varchar(100) NOT NULL,
  `Password` varchar(50) NOT NULL,
  `right` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

--
-- Dumping data for table `adminlogin`
--

INSERT INTO `adminlogin` (`id`, `Username`, `Password`, `right`) VALUES
(1, 'admin@gmail.com', '123', 1),

-- --------------------------------------------------------

--
-- Table structure for table `tbl_food`
--

CREATE TABLE IF NOT EXISTS `tbl_food` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `food_type` varchar(50) NOT NULL,
  `food_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

INSERT语句的末尾有一个逗号,而不是分号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM