dougou6727 2018-09-19 03:04
浏览 439
已采纳

尝试导入sql文件,但面临此错误

This is the error on cmd prompt:
C:\xampp\mysql\bin>mysql -p -u root --default_character_set utf8 recipes < recipes.sql
Enter password: ****

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

This is the error when I try to import on phpmyadmin `Error Static analysis:

4 errors were found during analysis.

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 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 '"admin" (

"admin_id" int(20) NOT NULL, "f_name" text NOT NULL, "l_name"' at line 20this is my code`

  • 写回答

1条回答 默认 最新

  • dotj78335 2018-09-19 03:53
    关注

    remove ""

    this should be the query

    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
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题