• MySQL使用小记


    时间格式化:

    select date_format('2008-08-08 22:23:01', '%Y%m%d%H%i%s');

    去重复:

    use iksdb3;
    select distinct `frequency` from iksdb3.channel;

    变量:

    show variables like 'log';

    更新时间(加一年):

    update iksdb3.iksuser set expire=date_add(expire, interval +1 year) where chipsn='8b73b8499b820000';

    锁定表与解锁:

    use iksdb3;
    flush tables with read lock;
    unlock tables;

    授予复制权限:

    grant replication slave on *.* to 'dbrep'@'192.168.0.110';

     查看与设置最大连接数:

    show variables like 'max_connections';
    show global status like 'max_used_connections';
    set GLOBAL max_connections=1500;
    //或修改my.cnf中的max_connections参数

     正则表达式以大写开头:

    select * from t_inventory_J1600352 where chipId REGEXP BINARY "^[A-Z]{1}";

     Ubuntu 14.04 LTS安装mariadb后只有root能登陆

    问题: 使用sudo mysql可以登录,使用mysqladmin设置密码后,普通用户无法登录.

    select user, plugin from user; 可以看到,用户的plugin为unix_socket

    update user set plugin=” where user=’root’; 将plugin清空.

  • 相关阅读:
    字符编码解码
    综合练习[购物车]
    for 循环实例
    数据类型
    字符串格式化输出
    集成开发环境
    while循环实例
    赋值运算符、逻辑运算符、表达式
    if,else语句猜最大值
    计算今天和今天的上一月的日期
  • 原文地址:https://www.cnblogs.com/hubery/p/4953379.html
Copyright © 2020-2023  润新知