【问题标题】:#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 'use [duplicate]#1064 - 您的 SQL 语法有错误;检查与您的 MariaDB 服务器版本相对应的手册,以了解在 'use [重复] 附近使用的正确语法
【发布时间】:2018-04-08 00:24:52
【问题描述】:

我正在尝试在 phpmyadmin 上运行 SQL,但出现错误,并且找不到其中的问题。

1064 - 您的 SQL 语法有错误;检查与您的 MariaDB 服务器版本相对应的手册,以了解要使用的正确语法 near 'use android_api /** 选择数据库 **/

我的代码如下:

create database android_api /** Creating Database **/ 
use android_api /** Selecting Database **/

create table users(
id int(11) primary key auto_increment,
unique_id varchar(23) not null unique,
name varchar(50) not null,
email varchar(100) not null unique,
encrypted_password varchar(80) not null,
salt varchar(10) not null,
created_at datetime,
updated_at datetime null
); /** Creating Users Table **/

【问题讨论】:

    标签: mysql


    【解决方案1】:

    删除 使用 android_api 。你不需要那个。 USE 语句仅在您每次开始 mysql 会话时使用。

    假设 android_api 已创建并且您已注销 mysql。再次登录时,只需使用USE 语句即可。

    编辑

    在用户和 (

    create table users (
    

    【讨论】:

    • 仍然出现错误:#1064 - 您的 SQL 语法有错误;检查与您的 MariaDB 服务器版本相对应的手册,以在第 2 行的“创建表用户(id int(11)主键 auto_increment,unique_id var”附近使用正确的语法
    • 答案已编辑..
    猜你喜欢
    • 2017-02-14
    • 1970-01-01
    • 1970-01-01
    • 2016-11-06
    • 1970-01-01
    • 2018-11-28
    • 2019-10-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多