发布于 2016-03-31 21:15:44 | 248 次阅读 | 评论: 1 | 来源: 网友投递

这里有新鲜出炉的Mysql教程,程序狗速度看过来!

Mysql关系型数据库管理系统

MySQL是一个开放源码的小型关联式数据库管理系统,开发者为瑞典MySQL AB公司。MySQL被广泛地应用在Internet上的中小型网站中。由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一特点,许多中小型网站为了降低网站总体拥有成本而选择了MySQL作为网站数据库。


这篇文章主要介绍了Mysql修改datadir导致无法启动问题解决方法,本文原因是SELINUX导致,用关闭SELINUX的方法解决了这个问题,需要的朋友可以参考下

centos6.2,停止mysqld然后修改/etc/my.cnf datadir的位置,启动mysqld提示FAILED,查看日志



120609 11:31:31 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

120609 11:35:12 mysqld_safe Starting mysqld daemon with databases from /mnt/hgfs/mysql_data

120609 11:35:13 [Warning] Can't create test file /mnt/hgfs/mysql_data/data.lower-test

120609 11:35:13 [Warning] Can't create test file /mnt/hgfs/mysql_data/data.lower-test

/usr/libexec/mysqld: Can't change dir to '/mnt/hgfs/mysql_data/' (Errcode: 13)

120609 11:35:13 [ERROR] Aborting

120609 11:35:13 [Note] /usr/libexec/mysqld: Shutdown complete

120609 11:35:13 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended


新的datadir路径确实没问题,而且目录和目录下所有文件都是777权限,上层目录也有rx权限,只不过datadir和下属文件owner都是root(因为我用虚拟机挂载的windows的文件系统)。后来想到应该是selinux搞的鬼,设置为permissive模式之后正常启动mysqld。


[root@data selinux]# getenforce

Enforcing

[root@data selinux]# setenforce 0

[root@data selinux]# getenforce

Permissive

setenforce 1 设置SELinux 成为enforcing模式
setenforce 0 设置SELinux 成为permissive模式

彻底关闭,vi /etc/selinux/config 修改 SELINUX=disabled



# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#     enforcing - SELinux security policy is enforced.

#     permissive - SELinux prints warnings instead of enforcing.

#     disabled - No SELinux policy is loaded.

SELINUX=disabled

# SELINUXTYPE= can take one of these two values:

#     targeted - Targeted processes are protected,

#     mls - Multi Level Security protection.

SELINUXTYPE=targeted



最新网友评论  共有(1)条评论 发布评论 返回顶部
nxetmw 发布于2016-09-10 11:16:37
终于搞定了,虽然不完美,都没有太大关系了
支持(0)  反对(0)  回复

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务