List:General Discussion« Previous MessageNext Message »
From:Johnny Withers Date:August 26 2009 1:02pm
Subject:Re: Fail to change MySQL data directory on ubuntu
View as plain text  
Yes, error 13, permission denied. Check selinux setup. I had this same
problem last week on a CentOS machine. I had to change the object type
of the new data dir to mysqld-something. I'm on a mobile phone and
can't remember the exact cmd.


On Tuesday, August 25, 2009, Jia Chen <chen.1002@stripped> wrote:
> I run sudo /etc/init.d/mysql start and check the syslog by running sudo tail -f
> /var/log/syslog
>
> This is what I get
> Aug 25 22:18:06 chenj-desktop mysqld_safe[10934]: started
> Aug 25 22:18:06 chenj-desktop kernel: [11083.933531] type=1503
> audit(1251253086.020:43): operation="inode_create" requested_mask="a::" denied_mask="a::"
> fsuid=0 name="/home/chenj/MySQL_data/chenj-desktop.lower-test" pid=10936
> profile="/usr/sbin/mysqld"
> Aug 25 22:18:06 chenj-desktop kernel: [11083.933581] type=1503
> audit(1251253086.020:44): operation="inode_create" requested_mask="a::" denied_mask="a::"
> fsuid=0 name="/home/chenj/MySQL_data/chenj-desktop.lower-test" pid=10936
> profile="/usr/sbin/mysqld"
> Aug 25 22:18:06 chenj-desktop mysqld[10937]: 090825 22:18:06 [Warning] option
> 'thread_stack': unsigned value 128 adjusted to 131072
> Aug 25 22:18:06 chenj-desktop mysqld[10937]: 090825 22:18:06 [Warning] Can't create
> test file /home/chenj/MySQL_data/chenj-desktop.lower-test
> Aug 25 22:18:06 chenj-desktop mysqld[10937]: 090825 22:18:06 [Warning] Can't create
> test file /home/chenj/MySQL_data/chenj-desktop.lower-test
> Aug 25 22:18:06 chenj-desktop mysqld[10937]: 090825 22:18:06  InnoDB: Operating
> system error number 13 in a file operation.
> Aug 25 22:18:06 chenj-desktop mysqld[10937]: InnoDB: The error means mysqld does not
> have the access rights to
> Aug 25 22:18:06 chenj-desktop mysqld[10937]: InnoDB: the directory.
> Aug 25 22:18:06 chenj-desktop mysqld[10937]: InnoDB: File name ./ibdata1
> Aug 25 22:18:06 chenj-desktop mysqld[10937]: InnoDB: File operation call: 'create'.
> Aug 25 22:18:06 chenj-desktop mysqld[10937]: InnoDB: Cannot continue operation.
> Aug 25 22:18:06 chenj-desktop kernel: [11083.962674] type=1503
> audit(1251253086.048:45): operation="inode_create" requested_mask="a::" denied_mask="a::"
> fsuid=110 name="/home/chenj/MySQL_data/ibdata1" pid=10936 profile="/usr/sbin/mysqld"
> Aug 25 22:18:06 chenj-desktop mysqld_safe[10944]: ended
> Aug 25 22:18:20 chenj-desktop /etc/init.d/mysql[11094]: 0 processes alive and
> '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
> Aug 25 22:18:20 chenj-desktop /etc/init.d/mysql[11094]: ^G/usr/bin/mysqladmin:
> connect to server at 'localhost' failed
> Aug 25 22:18:20 chenj-desktop /etc/init.d/mysql[11094]: error: 'Can't connect to
> local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
> Aug 25 22:18:20 chenj-desktop /etc/init.d/mysql[11094]: Check that mysqld is running
> and that the socket: '/var/run/mysqld/mysqld.sock' exists!
> Aug 25 22:18:20 chenj-desktop /etc/init.d/mysql[11094]:
>
> Does this message tell me any thing about the problem?  Thanks.
>
> Best,
> Jia
>
> Johnny Withers wrote:
>
> First, check the error log, if you can't find it, start mysql from the
> cmd line by running safe_mysqld it should print errors to console.
>
> If it is a permission issue, it might be caused be selinux, you'll
> need to change the object type od that new directory to mysqld-
> something. I can't recall the command. A google search on selinux and
> mysql should produce good results.
>
> On Tuesday, August 25, 2009, chen jia <chen.1002@stripped> wrote:
>
>
> Hi there,
>
> I am using MySQL on ubuntu 8.04.
>
> I followed this link
>
> http://www.ubuntu-howto.info/howto/how-to-move-mysql-databases-to-another-location-partition-or-hard-drive
> to change the data directory of MySQL.
>
> After stopping MySQL: sudo /etc/init.d/mysql stop
>
> I make a new directory: sudo mkdir /media/disk/MySQL_data
>
> then change the ownership of new directory, sudo chown mysql:mysql
> /media/disk/MySQL_data
>
> and copy all data to the new directory, cp -r -p /var/lib/mysql/*
> /media/disk/MySQL_data/ and deleted all files like ibdata1,
> ib_logfile0, and ib_logfile1.
>
> I then edit /etc/mysql/my.conf and update the "datadir" to my new
> directory. I also update /etc/apparmor.d/usr.sbin.mysql so that news
> lines with /var/lib/mysql replaced by /media/disk/MySQL_data are
> added.
>
> However, after sudo /etc/init.d/apparmor reload
>
> I try sudo /etc/init.d/mysql start
>
> I got
> * Starting MySQL database server mysqld
>         [fail]
>
> If I change the "datadir" line in /etc/mysql/my.conf back to the
> original one, I can start MySQL successfully.
>
> I think I have done everything needed to change MySQL data directory.
>
> Why am I still getting this error?  Where can I start to look for the causes?
>
> Thanks.
>
> Jia
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>
>
>
>
>
>
>
>
>

-- 
-----------------------------
Johnny Withers
601.209.4985
johnny@stripped
Thread
Fail to change MySQL data directory on ubuntuchen jia26 Aug
  • Re: Fail to change MySQL data directory on ubuntuJohnny Withers26 Aug
    • Re: Fail to change MySQL data directory on ubuntuJia Chen26 Aug
      • Re: Fail to change MySQL data directory on ubuntuJohnny Withers26 Aug
        • Re: Fail to change MySQL data directory on ubuntuJohnny Withers26 Aug
          • Re: Fail to change MySQL data directory on ubuntuJia Chen26 Aug
  • Re: Fail to change MySQL data directory on ubuntuClaudio Nanni27 Aug
    • Re: Fail to change MySQL data directory on ubuntuJia Chen27 Aug
      • Re: Fail to change MySQL data directory on ubuntuEric Bergen27 Aug
        • Re: Fail to change MySQL data directory on ubuntuJia Chen27 Aug
          • Re: Fail to change MySQL data directory on ubuntuJohnny Withers28 Aug
            • Re: Fail to change MySQL data directory on ubuntuchen jia29 Aug