From: Johnny Withers Date: August 26 2009 1:02pm Subject: Re: Fail to change MySQL data directory on ubuntu List-Archive: http://lists.mysql.com/mysql/218507 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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 wrote: > I run sudo /etc/init.d/mysql start and check the syslog by running sudo t= ail -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=3D1503 audit(12= 51253086.020:43): operation=3D"inode_create" requested_mask=3D"a::" denied_= mask=3D"a::" fsuid=3D0 name=3D"/home/chenj/MySQL_data/chenj-desktop.lower-t= est" pid=3D10936 profile=3D"/usr/sbin/mysqld" > Aug 25 22:18:06 chenj-desktop kernel: [11083.933581] type=3D1503 audit(12= 51253086.020:44): operation=3D"inode_create" requested_mask=3D"a::" denied_= mask=3D"a::" fsuid=3D0 name=3D"/home/chenj/MySQL_data/chenj-desktop.lower-t= est" pid=3D10936 profile=3D"/usr/sbin/mysqld" > Aug 25 22:18:06 chenj-desktop mysqld[10937]: 090825 22:18:06 [Warning] op= tion 'thread_stack': unsigned value 128 adjusted to 131072 > Aug 25 22:18:06 chenj-desktop mysqld[10937]: 090825 22:18:06 [Warning] Ca= n'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] Ca= n'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 =A0InnoDB: O= perating system error number 13 in a file operation. > Aug 25 22:18:06 chenj-desktop mysqld[10937]: InnoDB: The error means mysq= ld 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 oper= ation. > Aug 25 22:18:06 chenj-desktop kernel: [11083.962674] type=3D1503 audit(12= 51253086.048:45): operation=3D"inode_create" requested_mask=3D"a::" denied_= mask=3D"a::" fsuid=3D110 name=3D"/home/chenj/MySQL_data/ibdata1" pid=3D1093= 6 profile=3D"/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=3D/etc/mysql/debian.cnf ping' res= ulted in > Aug 25 22:18:20 chenj-desktop /etc/init.d/mysql[11094]: ^G/usr/bin/mysqla= dmin: connect to server at 'localhost' failed > Aug 25 22:18:20 chenj-desktop /etc/init.d/mysql[11094]: error: 'Can't con= nect 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? =A0Thanks. > > 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 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 > =A0 =A0 =A0 =A0[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? =A0Where can I start to look for the c= auses? > > Thanks. > > Jia > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: =A0 =A0http://lists.mysql.com/mysql?unsub=3Djohnny@pixela= ted.net > > > > > > > > > --=20 ----------------------------- Johnny Withers 601.209.4985 johnny@stripped