zoukankan      html  css  js  c++  java
  • mysql操作笔记

    mysql操作笔记

    • 查看当前用户,当前数据库

      • select user();
      • select database();
    • 查看引擎

      • 查看所有引擎:
        • show engines;
      • 查看表引擎:
        • show create table xxx;
      • 批量查看一个数据库所有表的引擎
        • show table status from anheisg;
    • 创建用户

      • CREATE USER 'username'@'host' IDENTIFIED BY 'password';
    • 用户权限

      • 查看用户权限
        • show grants for username@host;
      • 添加用户权限
        • grant privileges on *.*(datebase.table) to username@host;
      • 删除用户权限
        • revoke privilege on *.* from 'dw'@'%';
    • 密码相关

      • 修改用户密码
        • 方法一: update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';
        • 方法二:alter user 'root'@'localhost' identified by '123';
        • 方法三:set password for 'root'@'localhost'=password('123');
        • 更改之后刷新权限:flush privileges;
    • binlog相关操作

      • 查看当前正在写入的binlog文件:
        • show master status;
      • 查看binlog日志文件的操作事件:
        • show binlog events in 'mysql_bin.000005';
    • 表操作

      • 查看表字段:
        • desc table_name;
        • show columns from table_name;
      • 查看某数据库所有表的状态(status)信息
      • show table status from anheisg;
      • 创建表(例如):

      CREATE TABLE IF NOT EXISTS tt (
      id int(10) unsigned NOT NULL AUTO_INCREMENT,
      name varchar(16) NOT NULL,
      sex enum('m','w') NOT NULL DEFAULT 'm',
      age tinyint(3) unsigned NOT NULL,
      classid char(6) DEFAULT NULL,
      PRIMARY KEY (id)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

      • 删除表:
        • drop table table_name;
      • 添加表字段:
        • alter table 表名 add 字段名 字段类型;
      • limit
        • 查看前几条记录
          • select * from table limit n
        • 后几条记录
          • select * from table order by id desc limit n
  • 相关阅读:
    stand meeting
    ubuntu14.04安装百度云Bcloud
    4.1Reduction模型
    3.3分析卷积乘法优化的复用
    3.2 卷积
    3.1 全局存储带宽与合并访问 -- Global Memory(DRAM) bandwidth and memory coalesce
    AngularJS初探:搭建PhoneCat项目的开发与测试环境
    Centos 安装 NodeJS
    git安装
    CentOS安装VSFTP及配置用户
  • 原文地址:https://www.cnblogs.com/liushi-Oscar/p/9577589.html
Copyright © 2011-2022 走看看