0.常用命令

删除表中所有数据
truncate 表名;
reset master; 清除所有的bin-log日志
show master status;
查看授权用户
show grants for [email protected];
重启Mysql
pkill mysqld
1.Mysql授权
grant all on *.* to 'user1'@192.168.10.2 identified by 'pass';
select user,host,password from mysql.user;
2.Mysql的主从复制
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 status\G
3.Mysql手工备份
/usr/local/mysql/bin/mysqldump -uroot -p123 test -l -F '/tmp/test.sql'
4.Mysql bin-log日志手工恢复
/usr/local/mysql/bin/mysqlbinlog --no-defaults mysql-bin.000002 | /usr/local/mysql/bin/mysql -uroot -p123 test
5.Mysql数据库恢复
/usr/local/mysql/bin/mysql -uroot -p123 test