MySQL [Warning] Can’t create test file xxx lower-test(转)
add by zhj:修改的数据库的datadir,然后数据库就无法启动了,错误如下
2014-12-11 16:22:57 26309 [Warning] Can't create test file /data/mysql/server2.lower-test
2014-12-11 16:22:57 26309 [Warning] Can't create test file /data/mysql/server2.lower-test
2014-12-11 16:22:57 26309 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000) 2014-12-11 16:22:57 26309 [Warning] Buffered warning: Changed limits: table_cache: 431 (requested 2000) 2014-12-11 16:22:57 26309 [Note] Plugin 'FEDERATED' is disabled.
^G/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13 - Permission denied)
2014-12-11 16:22:57 26309 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
后面找到了这篇文章,解决了问题。另外要说明的是,apparmor不仅仅限制了mysql的datadir目录,还限制了config,log等等的目录。
另外,SELinux之于MySQL 这篇文章也写的很好。
原文:http://www.huoxingfan.com/834.html
我想,你一定是从搜索引擎搜索这个标题进来的!你一定是想改变mysql默认安装的数据目录!
你已经修改了my.cnf中的datadir的值
你已经chown和chmod了数次新数据目录或者其父路径的属主和权限
你无数次地试图service mysql start,或者 /etc/init.d/mysql start,以及mysql_install_db!
恭喜你看见这篇文章,我在被系统坑了几个小时之后,找到了解决的方法。
这个原因有二,其中任意的一个原因都会造成你被系统告知这个warning。如果你不是一个专业的linux系统安全工程师,或者你只是个PHP程序
员,并没有对系统安全有深入的研究,你就不会太容易找到它的答案。
第一,selinux,记得当年念书时,字符界面安装redhat(很古老的操作系统么。。。)的时候,有这么一个选项,通常大家都听取前辈的建议,改
变默认值以不安装它。但如果你恰好要操作的这台机器开着selinux,它确实能够使你的mysql无法在新目标位置进行mysql_install_db的操作,并
爆出标题所示的警告。一个简单的解决办法是使用命令暂时关闭selinux,以便让你的操作可以继续下去
setenforce 0
但最好使用一个永久方法,以便在重启后继续不要这货。
修改/etc/selinux/config文件中设置SELINUX=disabled ,然后重启或等待下次重启。(我用的是Azure的Ubuntu14.04,没有这个目录,OK,那就省事了)
第二,apparmor,这个坑爹货和selinux一样的坑爹,它也对mysql所能使用的目录权限做了限制
在 /etc/apparmor.d/usr.sbin.mysqld 这个文件中,有这两行,规定了mysql使用的数据文件路径权限
/var/lib/mysql/ r,
/var/lib/mysql/** rwk,
你一定看到了,/var/lib/mysql/就是之前mysql安装的数据文件默认路径,apparmor控制这里mysqld可以使用的目录的权限
我想把数据文件移动到/data/mysql下,那么为了使mysqld可以使用/data/mysql这个目录,照上面那两条,增加下面这两条就可以了
/data/mysql/ r,
/data/mysql/** rwk,
重启: sudo service apparmor restart
之后,就可以顺利地干你想干的事儿了。
MySQL [Warning] Can’t create test file xxx lower-test(转)的更多相关文章
- MySQL:Can't create test file XXX.lowe-test
问题说明 今天部署MySQL,在使用mysql_install_db,初始化数据库时报如下错误 180622 11:36:38 mysqld_safe Starting mysqld daemon w ...
- MYSQL Out of resources when opening file './xxx.MYD' (Errcode: 24)
出现Out of resources when opening file './xxx.MYD' (Errcode: 24)错误是因为打开的文件数超过了my.cnf的--open-files-limi ...
- Mysql 的MYISAM引擎拷贝出现异常——Incorrect information in file 'xxx.frm'
MYISAM引擎有三个文件 .FRM 存储表结构 .MYD 存储数据 .MYI 存储索引 当复制表时,将这三个文件同时复制到指定目录下. 异常处理: 1. Incorrect info ...
- Warning: Multiple build commands for output file /xxx
xcode中 有时候会报一个警告: [WARN]Warning: Multiple build commands for output file /xxx 要解决这个问题很简单: 1.选择你的工程 2 ...
- mysql 无法启动的原因Can't start server: can't create PID file: No space left on device
一大早来到公司,看到了一个噩梦,后台总是登录不上,登录就出错,还以为被黑客入侵了.经过1个小时的排错原因如下: 我的服务器是linux的,mysql的报错日志路径是/var/log/,经过查看日志发现 ...
- 执行make出现“Warning: File `xxx.c' has modification time 2.6e+04 s in the future“警告的解决方法
错误描述: 执行make命令时出现"make[2]: Warning: File `xxx.c' has modification time 1.6e+05 s in the future ...
- 静态库引入引起的错误解决方案,ld: warning: ignoring file ”…/XXX.a”, file was built for archive which is not the architecture being linked (armv7): “…/XXX.a” Undefined symbols for architecture armv7: "_OBJC_CLASS_$
想目中不免会引入一些静态库,可是有时加入'.a'文件后编译便会报以下错误 ld: warning: ignoring file ”…/XXX.a”, file was built for archiv ...
- Git error: unable to create file xxx: Filename too long
一.问题描述 在使用 git 时,提示 error: unable to create file xxx: Filename too long error: unable to create file ...
- mysql无法启动,报错 Can't start server: can't create PID file: No space left on device
然后看mysql日志文件 出现Can't start server: can't create PID file: No space left on device 这个错误. 提示磁盘空间不足 后用d ...
随机推荐
- CodeSmith listview属性
private void button1_Click(object sender, EventArgs e)//将数据库中读出来的信息直接显示在listview里 { //连接数据库 SqlConne ...
- HDU 1024 (不重叠m段最大和) Max Sum Plus Plus
题解是看的这里的: http://www.acmerblog.com/hdu-1024-Max-Sum-Plus-Plus-1276.html 当前这个状态是dp[i][j],i 表示当前的段,j表示 ...
- 点滴积累【JS】---JS小功能(createElement和insertBefore添加div下面的节点)
效果: 代码: <head runat="server"> <title></title> <script type="text ...
- C++获取进程号及窗口
#include <TlHelp32.h> //根据进程名获取进程ID BOOL GetPidByProcessName(TCHAR *pProcess, DWORD*dwPid) { H ...
- linux CPU loading calculate
http://hi.baidu.com/lionpanther/item/e908c37abdaf1c3f71442380 #include <stdio.h>#include <s ...
- I.MX6 ov5640 camera
/************************************************************************ * I.MX6 ov5640 camera * 说明 ...
- Mysql使用大全
#登录数据库 mysql -hlocalhost -uroot -p; #修改密码 mysqladmin -uroot -pold password new; #显示数据库 show database ...
- Spark快速入门(1)
1 安装Spark 首先,到 https://spark.apache.org/downloads.html 选择最新的 Spark 版本和 Hadoop 版本(实际上我们暂时用不上 Hadoop,所 ...
- SAS使用SPD引擎并报Encoding错误
ERROR: Unable to open data file because its file encoding differs from the SAS session encoding and ...
- 重拾Excel之为什么
现在如今想想自己,已经有许久许久没有充过电了.现在想好好地充电. 机遇总是垂青于有准备的人!