my.cnf检查是否正确:mysqld --help --verbose
方案一:
# 设置字符集
[client]
default_character_set=utf8
[mysqld]
character_set_server=utf8
collation_server = utf8_general_ci
# 用户授权[mysql主服务器(master)上创建(IP:192.168.1.1)]
mysql>grant all on *.* to 'user1'@'192.168.1.2' IDENTIFIED BY '123'; #允许user1能从192.168.1.2的服务器登陆到192.168.1.1的服务器中
或
1.mysql>grant all slave on *.* to user1@192.168.1.2 idenitify by '123'
||
2.mysql>grant replication slave on *.* to user1@192.168.1.2 idenitify by '123'
# 查看用户授权表
select user,host,password from mysql.user
# Mysql bin-log日志
开启Mysql bin-log日志
vi /etc/my.cnf
[mysqld]
port=3306
socket=/var/lib/myqsl/mysql.sock
log-slow-queries=mysql-slow.log # 慢查询日志
log-error=mysql.err # mysql错误日志
log=mysql.log
log-bin=mysql-bin # bin-log日志
# 命令查看bin-log是否开启
mysql>show variables like "%bin%";
在显示的选项中有
log_bin ON 说明已经开启了bin-log日志
一但开启后,就会在mysql数据根目录放置
mysql-bin开头的文件
# 与bin-log日志有关的日志刷新