【问题标题】:trying to import sql fle , but facing this error尝试导入 sql 文件,但遇到此错误
【发布时间】:2019-02-23 03:05:43
【问题描述】:

这是 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 上导入时出现的错误 `Error 静态分析:

在分析过程中发现了 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 说:文档

1064 - 您的 SQL 语法有错误;检查与您的 MariaDB 服务器版本相对应的手册,以了解在 '"admin" 附近使用的正确语法(

"admin_id" int(20) NOT NULL, “f_name”文本不为空, 第 20 行的“l_name”'this is my code`

【问题讨论】:

    标签: php mysql phpmyadmin xampp


    【解决方案1】:

    删除“”

    这应该是查询

    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
    

    【讨论】:

      猜你喜欢
      • 2022-10-16
      • 1970-01-01
      • 2019-10-13
      • 2018-03-25
      • 2010-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多