数据库分区:
修改Mysql分区后无法启动
[root@testenv etc]# cat my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/lib/mysql/mysqld.pid
#/var/run/mysqld/mysqld.pid
character_set_server = utf8
collation_server = utf8_bin
lower_case_table_names=1
max_connections=5000
max_error_count=100
log-warnings=0
wait_timeout=2880000
interactive_timeout = 2880000
max_allowed_packet = 100M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[root@testenv etc]#
mv /var/lib/mysql /home
ln -s /home/mysql /var/lib
chown -R mysql:mysql mysql
启动报报
2017-11-15 21:08:18 1926 [Warning] Can't create test file /var/lib/mysql/testenv.lower-test
2017-11-15 21:08:18 1926 [Warning] Can't create test file /var/lib/mysql/testenv.lower-test
/usr/sbin/mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13 - Permission denied)
原因是安装了SELINUX策略后,无论APACHE或MYSQL都要更改目录的权限,如果是APACHE,方法为:
# chcon -R -h -t httpd_sys_content_t /www/web/
如果是mysql,方法为:
# chcon -R -t mysqld_db_t /var/lib/mysql
# chcon -R -t mysqld_db_t /home/mysql
重新启动服务,OK
修改Mysql分区后无法启动
[root@testenv etc]# cat my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/lib/mysql/mysqld.pid
#/var/run/mysqld/mysqld.pid
character_set_server = utf8
collation_server = utf8_bin
lower_case_table_names=1
max_connections=5000
max_error_count=100
log-warnings=0
wait_timeout=2880000
interactive_timeout = 2880000
max_allowed_packet = 100M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[root@testenv etc]#
mv /var/lib/mysql /home
ln -s /home/mysql /var/lib
chown -R mysql:mysql mysql
启动报报
2017-11-15 21:08:18 1926 [Warning] Can't create test file /var/lib/mysql/testenv.lower-test
2017-11-15 21:08:18 1926 [Warning] Can't create test file /var/lib/mysql/testenv.lower-test
/usr/sbin/mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13 - Permission denied)
原因是安装了SELINUX策略后,无论APACHE或MYSQL都要更改目录的权限,如果是APACHE,方法为:
# chcon -R -h -t httpd_sys_content_t /www/web/
如果是mysql,方法为:
# chcon -R -t mysqld_db_t /var/lib/mysql
# chcon -R -t mysqld_db_t /home/mysql
重新启动服务,OK
768

被折叠的 条评论
为什么被折叠?



