ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
第十一集 MySQL grant用户授权 * * * * * ~~~ 一.Mysql用户授权 创建用户: CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass' create user 'test'@'localhost' identified by '123'; 给从服务器设置授权用户 1.grant all on *.* to user@192.168.10.2 identified by "pass"; 2.grant replication slave on *.* to user@192.168.10.2 identified by "pass"; 查看用户授权表 select user,host,password from mysql.user; 二.Mysql bin-log日志 开启Mysql bin-log日志 vi /etc/my.cnf [mysqld] port=3306 socket=/var/lib/mysql/mysql.sock log-slow-queries=mysql-slow.log //设置一个时间,超过这个时间的查询就保存到这日志里.方便调优 log-error=mysql.err log=mysql.log log-bin=mysql-bin 查看bin-log日志 show variables like "%log%"; Mysql中查看ls /var/lib/mysql system ls log-bin保存在/var/lib/mysql下 与bin-log有关的日志刷新 flush logs; 此时就会多一个最新的bin-log日志 show master status 查看最后一个bin日志 reset master; 清空所有的bin-log日志 mysqlbinlog --no-defaults mysql-00001.bin 用mysqlbinlog mysql-00001.bin时报错,说是字符集有问题 mysqlbinlog mysql-bin.000002 |mysql -uroot -p t1 三.Mysql主从复制 四.Mysql分区技术 ~~~