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

报告相同问题?

悬赏问题

  • ¥188 寻找能做王者评分提取的
  • ¥15 matlab用simulink求解一个二阶微分方程,要求截图
  • ¥30 乘子法解约束最优化问题的matlab代码文件,最好有matlab代码文件
  • ¥15 写论文,需要数据支撑
  • ¥15 identifier of an instance of 类 was altered from xx to xx错误
  • ¥100 反编译微信小游戏求指导
  • ¥15 docker模式webrtc-streamer 无法播放公网rtsp
  • ¥15 学不会递归,理解不了汉诺塔参数变化
  • ¥15 基于图神经网络的COVID-19药物筛选研究
  • ¥30 软件自定义无线电该怎样使用