0.常用命令
1
2
3
4
5
6
7
8
|
删除表中所有数据 truncate 表名; reset master; 清除所有的bin-log日志 show master status; 查看授权用户 show grants for user1@192.168.10.2; 重启Mysql pkill mysqld |
1.Mysql授权
1
2
|
grant all on *.* to 'user1' @192.168.10.2 identified by 'pass' ; select user,host,password from mysql.user; |
2.Mysql的主从复制
1
2
3
|
change master to master_host= '192.168.10.1' , master_user= 'slave' , master_password= 'test.com' , master_log_file= 'mysql-bin.000007' , master_log_pos=334; start slave; show slave statusG |
3.Mysql手工备份
1
|
/usr/local/mysql/bin/mysqldump -uroot -p123 test -l -F '/tmp/test.sql' |
4.Mysql bin-log日志手工恢复
1
|
/usr/local/mysql/bin/mysqlbinlog --no-defaults mysql-bin.000002 | /usr/local/mysql/bin/mysql -uroot -p123 test |
5.Mysql数据库恢复
1
|
/usr/local/mysql/bin/mysql -uroot -p123 test < /tmp/test .sql |