加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

启动mysql报Can't create test file /data/mysql/host2.lower-test错误

(2014-12-11 15:40:45)
标签:

股票

分类: 数据库

今天在 Linux 系统上移动 MySQL 的数据库目录

配置如下:

/etc/my.cnf

[mysqld]
datadir=/home/mysql
socket=/var/lib/mysql/mysql.sock

更改完配置文件重启MYSQL的时候出现的以下问题

110222 11:15:07 mysqld_safe Starting mysqld daemon with databases from /home/mysql
110222 11:15:07 [Warning] Can't create test file /home/mysql/localhost.lower-test
110222 11:15:07 [Warning] Can't create test file /home/mysql/localhost.lower-test
 /usr/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
110222 11:15:07 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
110222 11:15:07  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
110222 11:15:07 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

当初以为只是文件或文件夹权限问题,把所有对应的目录和文件的权限改成读写状态...还是没用...

在网上找了一会儿,找到解决方法了~

解决方法如下:

#在终端中先输入下面这一行

chown -R mysql:mysql /home/data/mysql
#在输入下面的一行就OK了

chcon -R -t mysqld_db_t /home/mysql

#重启下MYSQL试试~

/etc/init.d/mysqld restart

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有