zoukankan      html  css  js  c++  java
  • 数据库授权

    设置其他主机能使用 root 登陆数据库
    Mysql>GRANT ALL PRIVILEGES ON * . * TO 'root'@'%'IDENTIFIED BY 'password'
    Mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'10.%'IDENTIFIED BY 'MYSQL@2018' WITH GRANT OPTION; 
    设置 user 账户能从 10.10.0.1 服务器登陆本机,且拥有所有权限
    Mysql>grant all privileges on *.* to user@10.10.0.1 indentified by ‘password’
    user 账户只有备份权限
    Mysql>grant replication slave on *.* to user@10.10.0.1 indentified by 'password'
    查看某个用户有哪些权限
    show grants for root@127.0.0.1;
    GRANT ALL PRIVILEGES ON `DB_NAME`.* TO 'DBUSER'@'127.0.0.1' WITH GRANT OPTION;
    使添加的账号生效:FLUSH PRIVILEGES;
    Flush logs; 增加一个最新的 bin-log 日志
    Truncate  tables;   清空当前表中的所有数据
    Reset master;清空所有的 bin-log 日志
    进入二进制日志目录,输入下面语句可查看二进制日志:
    mysqlbinlog –no-defaults  mysql-bin.000001 | more
    若编译安装的 Mysql,选择 mysql 安装目录下执行 Mysql/bin/mysqlbinlog 

    数据恢复

    Mysql/bin/mysqlbinlog –no-defaults  mysql-bin.000001 |mysql –u –root –p(password) (可选 database)

    例如通过 Bin-log 日志恢复 position 段 100 到 500 的数据:

    1、先查看 position 段中日志,确实是否需要恢复

    mysqlbinlog –no-defaults mysql-bin.000002 –start-position=”100”–stop-position=”500” |more

    注意 position100 可能不会恢复。因为执行语句在 Position 日志之上。

    –start-position 和 –stop-position 可选择一个执行。无需同时存在。

    Btw:时间段恢复参数为:–stop-date= “2014-01-01 12:00:00” 、

    –start-date = “2014-01-01 12:00:00”

  • 相关阅读:
    数据处理
    Interleaving String
    Distinct Subsequences
    caffe 输入图像图像加高斯噪声
    caffe resize用interpolation
    软件測试基本方法(七)之验收測试
    CSS入门学习
    bzoj1458 士兵占据
    Swift高阶函数介绍(闭包、Map、Filter、Reduce)
    每天一点儿Java--list
  • 原文地址:https://www.cnblogs.com/Mrhuangrui/p/4564177.html
Copyright © 2011-2022 走看看