这是cmd提示符下的错误:
C:\xampp\mysql\bin>mysql -p -u root --default_character_set utf8 recipes < recipes.sql
输入密码:****
ERROR 1064 (42000) at line 20: 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 '"admin" (
"admin_id" int(10) NOT NULL,
"f_name" text NOT NULL,
"l_name" te' at line 1
这是我尝试在phpmyadmin上导入时的错误`错误 静态分析:
在分析过程中发现4个错误。
A symbol name was expected! (near ""admin_id"" at position 383)
At least one column definition was expected. (near ""admin_id"" at position 383)
Unexpected beginning of statement. (near "20" at position 398)
Unrecognized statement type. (near "NOT NULL" at position 402)
SQL query:
-- phpMyAdmin SQL Dump -- version 4.8.3. -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: August 29, 2018 at 09:56 AM -- Server version: 5.1.37 -- PHP Version: 7.2.9 -- -- Database: `recipes` -- -- -------------------------------------------------------- -- -- Table structure for table `admin` -- CREATE TABLE IF NOT EXISTS "admin" ( "admin_id" int(20) NOT NULL, "f_name" text NOT NULL, "l_name" text NOT NULL, "email" varchar(250) NOT NULL, "c_email" varchar(250) NOT NULL, "pass" varchar(250) NOT NULL, "c_pass" varchar(250) NOT NULL, "u_name" varchar(150) NOT NULL, "address" text NOT NULL, "date_of_birth" varchar(50) NOT NULL, "city" text NOT NULL, "state" text NOT NULL, "country" text NOT NULL, "gender" text NOT NULL, "p_o" int(50) NOT NULL, PRIMARY KEY ("admin_id") ) AUTO_INCREMENT=1
MySQL说:文档
“ admin_id” int(20)NOT NULL, “ f_name”文字NOT NULL, 第20行上的“ l_name”'this is my code`
答案 0 :(得分:0)
删除“”
这应该是查询
CREATE TABLE IF NOT EXISTS admin
(
admin_id int(20) NOT NULL,
f_name text NOT NULL,
l_name text NOT NULL,
email varchar(250) NOT NULL,
c_email varchar(250) NOT NULL,
pass varchar(250) NOT NULL,
c_pass varchar(250) NOT NULL,
u_name varchar(150) NOT NULL,
address text NOT NULL,
date_of_birth varchar(50) NOT NULL,
city text NOT NULL,
state text NOT NULL,
country text NOT NULL,
gender text NOT NULL,
p_o int(50) NOT NULL,
PRIMARY KEY (admin_id)
) AUTO_INCREMENT=1