将.sql导入phpMyAdmin db

时间:2017-10-24 00:04:16

标签: mysql sql

我想将一个SQL文件导入我的phpMyAdmin数据库,该文件包含有关餐馆应用程序的表格和一个关于管理员登录的表格,但我有2个意外错误,我真的不知道究竟是什么错误接着就,随即?。这是错误消息:

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

这是显示错误的两个表。对此有何见解?谢谢

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 ;

1 个答案:

答案 0 :(得分:0)

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