• MySQL 的基本操作(命令行)


    第一步:新建用户

    先登录进root用户,然后再利用root用户的权限进行创建用户操作

    mysql> create user 'test'@'localhost' identified by '888888';

    刷新授权:mysql> flush privileges;

    为新用户分配权限:mysql> grant all privileges on car.* to test@localhost;

    第二步:建表导入数据

    CREATE TABLE pet (name VARCHAR(20), owner VARCHAR(20),
           species VARCHAR(20), sex CHAR(1), birth DATE, death DATE);

    然后出现了错误:

    mysql> LOAD DATA LOCAL INFILE 'C:UsersAdministratorDesktoppet.txt' INTO TABLE pet;
    ERROR 1148 (42000): The used command is not allowed with this MySQL version

       解决方案

    mysql> SHOW VARIABLES LIKE 'local_infile';

     状态:ON 结果也还是不行,退出重来

    C:UsersAdministrator>mysql --local_infile=1 -u test -p
    mysql> LOAD DATA LOCAL INFILE 'C:UsersAdministratorDesktoppet.txt' INTO TABLE pet;
    ERROR 2 (HY000): File 'C:UsersAdministratorDesktoppet.txt' not found (OS errno 2 - No such file or directory)
    mysql> LOAD DATA LOCAL INFILE 'C:/Users/Administrator/Desktop/pet.txt' INTO TABLE pet;
    Query OK, 8 rows affected, 7 warnings (0.11 sec)
    Records: 8  Deleted: 0  Skipped: 0  Warnings: 7

      结果:载入数据成功

  • 相关阅读:
    Java Stream 流(JDK 8 新特性)
    Java EnumMap 实现类
    Java 设计模式
    Java lambda 表达式详解(JDK 8 新特性)
    Java forEach 方式遍历集合(Java 8 新特性)
    Java 单例设计模式
    Java public 和 private 访问修饰符
    == 、equals 、hashcode
    String
    ClassLoader 的分类及加载顺序
  • 原文地址:https://www.cnblogs.com/wdyaoyao/p/10763291.html
Copyright © 2020-2023  润新知