我已经在我的CentOS 6.1服务器上编译了Percona 5.5,并且它开始很好,但是它似乎没有读取我的/etc/my.cnf文件。
# In /etc/my.cnf character_set_server = utf8 collation_server = utf8_general_ci mysql> show variables like 'character_set_server'; +----------------------+--------+ | Variable_name | Value | +----------------------+--------+ | character_set_server | latin1 | +----------------------+--------+ 1 row in set (0.00 sec)
在这里,我期望看到'utf8'的值,而不是latin1。
目前/etc/my.cnf设置为一个符号链接,指向一个当前处于版本控制的my.cnf文件,所以它看起来像:
root@host ~/MyFile/Setup # -> ls /etc/my.cnf lrwxrwxrwx. 1 root root 64 Dec 17 19:05 /etc/my.cnf -> /home/src/config/current/sys/etc/mysql/prod/confs-enabled/my.cnf
在初次使用Google之后,似乎需要使用--defaults-file=/etc/my.cnf标志专门设置my.cnf文件的path。 目前没有通过CentOS守护进程脚本设置:
ps auxfw > tmp.txt vi tmp.txt root 11798 0.0 0.1 106044 1488 pts/0 S 19:09 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/host.localdomain.pid mysql 11875 0.1 4.3 499560 43936 pts/0 Sl 19:09 0:00 \_ /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/host.localdomain.err --pid-file=/var/lib/mysql/host.localdomain.pid
所以我的问题是,如何添加将--defaults-file=/etc/my.cnf标志传递给/etc/init.d/mysql守护进程脚本的function?
谢谢。
– 更新 –
这个问题似乎是因为我有selinux策略设置为执行,并尝试符号链接my.cnf。 考虑以下:
lrwxrwxrwx. 1 root root 72 Feb 7 05:02 my.cnf -> /home/src/config/current/sys/etc/mysql/prod/confs-available/my-large.cnf
和/ home / src烫发看起来像:
drwxrwxr-x. src src unconfined_u:object_r:user_home_t:s0 config
如果我复制相同的确切文件到/ etc,它的工作原理,如果我禁用selinux,它也可以。 所以这与mysql试图访问/ home / src的事实有关。
另外,我做了audit2why,它回答了:
Feb 8 17:32:20 app-mldrinks-aa-1 kernel: type=1400 audit(1328722340.203:17): avc: denied { read } for pid=2109 comm="mysqld" name="xvda" dev=devtmpfs ino=5801 scontext=unconfined_u:system_r:mysqld_t:s0 tcontext=system_u:object_r:fixed_disk_device_t:s0 tclass=blk_file Was caused by: Missing type enforcement (TE) allow rule. You can use audit2allow to generate a loadable module to allow this access.
有没有办法使这个工作,而不必创build一个自定义的selinux模块? 我无法将/home/src/config/current的上下文types更改为mysqld_db_t因为每次我推送一个configuration文件时,都会使用user_home_t创build一个新的目录,其中包含最新的更改。
也许你可以用另一种方式来解决它 – 试图find哪个my.cnf是percona试图读取的。
即。 mysqld --help --verbose | head -n 30 mysqld --help --verbose | head -n 30并寻找类似的东西
Default options are read from the following files in the given order: /etc/mysql/my.cnf ~/.my.cnf
我最终只是从版本控制path复制my.cnf到/etc/my.cnf,一切正常。 继续下去,直到我可以放下更多的时间,并configurationselinux以允许mysqld访问/ home / src / config。