From: Eric Bergen Date: August 27 2009 5:51pm Subject: Re: Fail to change MySQL data directory on ubuntu List-Archive: http://lists.mysql.com/mysql/218523 Message-Id: <11b1bd990908271051o6adc9c87w5a4e9f0e935a6c7d@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable That procedure is horribly incorrect. You should simply move the ib_log and ibdata files with the rest of the datadir. The ibdata1 file contains innodb's system tables and depending on your setting of innodb_file_per_table it also contains your data! On Thu, Aug 27, 2009 at 7:56 AM, Jia Chen wrote: >> Chen, Did you really delete ibdata1 ? > > Yes, I did. > > Best, > Jia > > > Claudio Nanni wrote: >> >> >> 2009/8/26 chen jia > >> >> =A0 =A0Hi there, >> >> =A0 =A0I am using MySQL on ubuntu 8.04. >> >> =A0 =A0I followed this link >> >> =A0http://www.ubuntu-howto.info/howto/how-to-move-mysql-databases-to-ano= ther-location-partition-or-hard-drive >> =A0 =A0to change the data directory of MySQL. >> >> =A0 =A0After stopping MySQL: sudo /etc/init.d/mysql stop >> >> =A0 =A0I make a new directory: sudo mkdir /media/disk/MySQL_data >> >> =A0 =A0then change the ownership of new directory, sudo chown mysql:mysq= l >> =A0 =A0/media/disk/MySQL_data >> >> =A0 =A0and copy all data to the new directory, cp -r -p /var/lib/mysql/* >> =A0 =A0/media/disk/MySQL_data/ and deleted all files like ibdata1, >> >> >> Chen, Did you really delete ibdata1 ? >> >> >> >> >> >> >> =A0 =A0ib_logfile0, and ib_logfile1. >> >> =A0 =A0I then edit /etc/mysql/my.conf and update the "datadir" to my new >> =A0 =A0directory. I also update /etc/apparmor.d/usr.sbin.mysql so that n= ews >> =A0 =A0lines with /var/lib/mysql replaced by /media/disk/MySQL_data are >> =A0 =A0added. >> >> =A0 =A0However, after sudo /etc/init.d/apparmor reload >> >> =A0 =A0I try sudo /etc/init.d/mysql start >> >> =A0 =A0I got >> =A0 =A0* Starting MySQL database server mysqld >> =A0 =A0 =A0 =A0 =A0 [fail] >> >> =A0 =A0If I change the "datadir" line in /etc/mysql/my.conf back to the >> =A0 =A0original one, I can start MySQL successfully. >> >> =A0 =A0I think I have done everything needed to change MySQL data direct= ory. >> >> =A0 =A0Why am I still getting this error? =A0Where can I start to look f= or >> =A0 =A0the causes? >> >> =A0 =A0Thanks. >> >> =A0 =A0Jia >> >> =A0 =A0-- >> =A0 =A0MySQL General Mailing List >> =A0 =A0For list archives: http://lists.mysql.com/mysql >> =A0 =A0To unsubscribe: >> http://lists.mysql.com/mysql?unsub=3Dclaudio.nanni@stripped >> >> > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: =A0 =A0http://lists.mysql.com/mysql?unsub=3Deric.bergen@g= mail.com > > --=20 Eric Bergen eric.bergen@stripped http://www.ebergen.net