Mysql修改datadir导致无法启动问题解决方法_MySQL教程

编辑Tag赚U币
教程Tag:暂无Tag,欢迎添加,赚取U币!

推荐:mysql 查询重复的数据的SQL优化方案
在mysql中查询不区分大小写重复的数据,往往会用到子查询,并在子查询中使用upper函数来将条件转化为大写。如: 代码如下: select * from staticcatalogue WHERE UPPER(Source) IN (SELECT UPPER(Source) FROM staticcatalogue GROUP BY UPPER(Source) having count(UP

 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

分享:mysql的左右内连接用法实例
本文实例讲述了mysql的左右内连接用法。分享给大家供大家参考。具体如下: 用个例子来解析下mysql的左连接, 右连接和内连接 代码如下:create table user_id ( id decimal(18) ); create table user_profile ( id decimal(18) , name varchar(255) ) ; insert into use

来源:模板无忧//所属分类:MySQL教程/更新时间:2015-03-07
相关MySQL教程