单实例MySQL的/etc/my.cnf配置文件

[root@localhost ~]# vim /etc/my.cnf

[mysqld]

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

 

以上是初始值,可以自己写在/etc下面。

 

下面是手动编辑增加:

binlog_format=mixed  //设置mysql记录二进制的格式是mixed

binlog_do_db=***  // 表示需要复制的数据库,多个数据库要分开写,全备份可以不写

binlog_ignore_db=***  // 表示不需要复制的数据库

default-character-set=utf8

 

[mysqld_safe]
log-error=/var/log/mysql/mysql-error.log  //设置错误日志

 

举例:

[danny@ay-wifi-hz-01 ~]$ cat /etc/my.cnf
[mysqld]
#datadir=/var/lib/mysql
datadir=/opt/rh/mysql55/root/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0

server-id = 50225
expire_logs_day = 30

log-bin = /mnt/mysql-binlogs/mysql-bin
binlog_format = MIXED


[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

 

posted @ 2014-10-05 15:00  chromebook  阅读(1068)  评论(0编辑  收藏  举报