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

      载入数据成功

     

  • 相关阅读:
    数据提交方式:post和get
    什么是SQL注入式攻击和如何防范?
    CSS3 @keyframes 规则
    php数据库连接及简单操作
    深入理解CSS过渡transition
    css 选择器
    利用border制作三角形原理
    iOS 8 自适应 Cell
    dSYM 文件分析工具
    iOS开发使用半透明模糊效果方法整理
  • 原文地址:https://www.cnblogs.com/sece/p/10657230.html
Copyright © 2011-2022 走看看