mysql主从复制基础_01

1.修改密码:alter user 'root' @'localhost'  identified by 'root';

2.查看密码复杂程度:show variables  like  'validate_password%'; 

改密码复杂度(5.7以下版本):set global validate_password_policy=0;     (validate_password_policy决定密码的验证策略,默认等级为MEDIUM(中等),可通过以下命令修改为LOW(低)    mysql8.0版本命令:set global validate_password.policy=0;)

设置密码长度:set global validate_password_length=1;   (8.0版本: set global validate_password.length=1;  )

3.查询用户信息  :select user,host from mysql.user;

4.赋予test用户所有的权限:grant all on *.* from ''test@'%';

5.回收用户test的所有权限:revoke all on *.* from  'test'@'%';

6.赋予test用户主从复制的所有数据库,所有ip的权限:grant replication slave on *.* to 'test' @'%';

7.删除用户:drop user 'test';

8.查看建表的语句:show create table user\G

9.mysqldump备份mysql数据库:mysqldump -uroot -p mysql > /root/mysqlbak.sql

10.主从备份的优点:数据冗余,提高数据的安全性。读写分离,提高数据库负载

11.创建主从复制的用户(repl用户,针对153的所有网段):create user 'repl'@'192.168.153.%' identified by 'repl';

12主从用户赋予权限:grant replication slave on *.* to 'repl'@‘192.168.153.%’ identified by 'repl';

 

posted @ 2021-12-26 23:07  当时只道是寻常呀  阅读(32)  评论(0)    收藏  举报