zoukankan      html  css  js  c++  java
  • MySQL新加用户和开启慢查询

    mysql>grant select on *.* to read@'%' identified by 'j';  //给予read用户只读全部库的权限

    mysql>grant select,delete,update,create,drop on *.* to test@"%" identified by "1234";  //test用户对所有数据库都有select,delete,update,create,drop 权限。

    mysql>flush privileges; //刷新系统权限表

    //@"%" 表示对所有非本地主机授权,不包括localhost。

    //对localhost授权:加上一句grant all privileges on testDB.* to test@localhost identified by '1234';即可。

    格式:grant 权限 on 数据库.* to 用户名@登录主机 identified by "密码";

    开启慢查询my.cnf 加入下来代码

    slow_query_log=1   //开启慢查询
    long_query_time=1  //超过1s记录
    slow_query_log_file=/usr/local/mysql/slowquery.log  //记录的log文件地址

      

      GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.60.17' IDENTIFIED BY 'cc.123' WITH GRANT OPTION;

      执行上面命令还是不能远程连接

      GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.60.17' IDENTIFIED BY 'cc.123';

      再执行上面的命令,就可以用客户端连接了!

      SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;

      给与授权权限:

         GRANT  USAGE ON  *.* TO 'root'@'%' WITH GRANT OPTION;

    SET  GLOBAL slow_query_log=ON
    SET  long_query_time=4; 
  • 相关阅读:
    SQL游标写法代码
    关键词过滤器
    TOP4NET20107027源代码非官方
    亚马逊API之订单下载
    PHP上传大文件参数设置
    CListCtrl中的一个错误(c++)
    汇编语言数据结构
    类型为“System.OutOfMemoryException”的异常
    【javascript脚本】动态设置div的高度和宽带
    【读书笔记】串指令备注
  • 原文地址:https://www.cnblogs.com/zping/p/4864475.html
Copyright © 2011-2022 走看看