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; 
  • 相关阅读:
    re正则表达式公式讲解3
    re正则表达式2
    re正则表达式公式讲解1
    洛谷 P2962 [USACO09NOV]灯Lights
    9.26模拟赛
    BZOJ 1567: [JSOI2008]Blue Mary的战役地图

    洛谷 P2919 [USACO08NOV]守护农场Guarding the Farm
    洛谷P3252 [JLOI2012]树
    P3183 [HAOI2016]食物链
  • 原文地址:https://www.cnblogs.com/zping/p/4864475.html
Copyright © 2011-2022 走看看