zoukankan      html  css  js  c++  java
  • MySQL 基本操作(命令行)

    • 新建用户

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

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

    刷新授权:mysql> flush privileges;

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

    • 建表导入数据(txt)
    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';

    set global local_infile=ON;

     状态: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

      载入数据成功

     

  • 相关阅读:
    git command
    MySQL命令行学习
    添加react-router
    nodejs 安装出错总结
    切换分支之后,意外出现的,待提交的改变
    git diff
    git log
    搜索的技巧
    x-shell code
    css汇总
  • 原文地址:https://www.cnblogs.com/sece/p/10657230.html
Copyright © 2011-2022 走看看