How do I change MySQL data folder and move data over on ubuntu 10.04?

How do I change MySQL data folder and move data over on ubuntu 10.04?

am 29.08.2010 21:20:41 von chen jia

Hi there,

I install ubuntu 10.04 (64bit) on my desktop and try to move my
existing MySQL data over.

I first install MySQL on the new machine, and it can start and stop
fine. I decide to change the data folder from the default
(/var/lib/mysql) to /home/MyAccount/MySQLdata and move my existing
MySQL data to that directory.

Because I used to use MySQL on my laptop and set the data directory on
a USB drive, my existing data is on the USB drive. I connect the USB
drive to the desktop and copy the old data folder to the new data
folder by using
sudo rsync -av /media/USBdrive/MySQLdata/ /home/MyAccount/MySQLdata.

Then, I change the ownership of the new folder by using sudo chown
mysql:mysql /home/MyAccount/MySQLdata.

Next, I edit /etc/mysql/my.conf and update the "datadir" to my new
directory. I also update /etc/apparmor.d/usr.sbin.mysql so that lines
with /var/lib/mysql are commented out and news lines with
/home/MyAccount/MySQLdata are added. I reload the apparmor by using
sudo /etc/init.d/apparmor reload.

However, when I try to start mysql with sudo start mysql, it hangs.
When I try sudo mysqld and connect to mysql by using mysql -u root -p,
it complains: ERROR 2002 (HY000): Can't connect to local MySQL server
through socket '/var/run/mysqld/mysqld.sock' (111)

Do you have any idea what I need to test and/or do to fix this problem? Thanks.

Best,
Jia

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: How do I change MySQL data folder and move data over on ubuntu 10.04?

am 29.08.2010 22:02:53 von Sabika Gmail

Does your mysql sock file reside in the same location as the error?



On Aug 29, 2010, at 12:20 PM, chen jia wrote:

> Hi there,
>=20
> I install ubuntu 10.04 (64bit) on my desktop and try to move my
> existing MySQL data over.
>=20
> I first install MySQL on the new machine, and it can start and stop
> fine. I decide to change the data folder from the default
> (/var/lib/mysql) to /home/MyAccount/MySQLdata and move my existing
> MySQL data to that directory.
>=20
> Because I used to use MySQL on my laptop and set the data directory on
> a USB drive, my existing data is on the USB drive. I connect the USB
> drive to the desktop and copy the old data folder to the new data
> folder by using
> sudo rsync -av /media/USBdrive/MySQLdata/ /home/MyAccount/MySQLdata.
>=20
> Then, I change the ownership of the new folder by using sudo chown
> mysql:mysql /home/MyAccount/MySQLdata.
>=20
> Next, I edit /etc/mysql/my.conf and update the "datadir" to my new
> directory. I also update /etc/apparmor.d/usr.sbin.mysql so that lines
> with /var/lib/mysql are commented out and news lines with
> /home/MyAccount/MySQLdata are added. I reload the apparmor by using
> sudo /etc/init.d/apparmor reload.
>=20
> However, when I try to start mysql with sudo start mysql, it hangs.
> When I try sudo mysqld and connect to mysql by using mysql -u root -p,
> it complains: ERROR 2002 (HY000): Can't connect to local MySQL server
> through socket '/var/run/mysqld/mysqld.sock' (111)
>=20
> Do you have any idea what I need to test and/or do to fix this problem? Th=
anks.
>=20
> Best,
> Jia
>=20
> --=20
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dsabika.makhdoom@gm=
ail.com
>=20

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg

Re: How do I change MySQL data folder and move data over on ubuntu 10.04?

am 29.08.2010 22:18:27 von chen jia

I think so.

When I run
ls -l /var/run/mysqld/

I get
total 0
srwxrwxrwx 1 mysql mysql 0 2010-08-29 14:45 mysqld.sock


On Sun, Aug 29, 2010 at 4:02 PM, Sabika Gmail w=
rote:
> Does your mysql sock file reside in the same location as the error?
>
>
>
> On Aug 29, 2010, at 12:20 PM, chen jia wrote:
>
>> Hi there,
>>
>> I install ubuntu 10.04 (64bit) on my desktop and try to move my
>> existing MySQL data over.
>>
>> I first install MySQL on the new machine, and it can start and stop
>> fine. I decide to change the data folder from the default
>> (/var/lib/mysql) to /home/MyAccount/MySQLdata and move my existing
>> MySQL data to that directory.
>>
>> Because I used to use MySQL on my laptop and set the data directory on
>> a USB drive, my existing data is on the USB drive. I connect the USB
>> drive to the desktop and copy the old data folder to the new data
>> folder by using
>> sudo rsync -av /media/USBdrive/MySQLdata/ /home/MyAccount/MySQLdata.
>>
>> Then, I change the ownership of the new folder by using sudo chown
>> mysql:mysql /home/MyAccount/MySQLdata.
>>
>> Next, I edit /etc/mysql/my.conf and update the "datadir" to my new
>> directory. I also update /etc/apparmor.d/usr.sbin.mysql so that lines
>> with /var/lib/mysql are commented out and news lines with
>> /home/MyAccount/MySQLdata are added. I reload the apparmor by using
>> sudo /etc/init.d/apparmor reload.
>>
>> However, when I try to start mysql with sudo start mysql, it hangs.
>> When I try sudo mysqld and connect to mysql by using mysql -u root -p,
>> it complains: ERROR 2002 (HY000): Can't connect to local MySQL server
>> through socket '/var/run/mysqld/mysqld.sock' (111)
>>
>> Do you have any idea what I need to test and/or do to fix this problem? =
Thanks.
>>
>> Best,
>> Jia
>>
>> --
>> MySQL General Mailing List
>> For list archives: http://lists.mysql.com/mysql
>> To unsubscribe: =A0 =A0http://lists.mysql.com/mysql?unsub=3Dsabika.makhd=
oom@gmail.com
>>
>

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg

Re: How do I change MySQL data folder and move data over on ubuntu 10.04?

am 30.08.2010 03:08:37 von chen jia

After I run sudo mysqld, I run sudo /etc/init.d/mysql start and check
the syslog by running sudo tail -f /var/log/syslog, the output is

Aug 29 21:05:42 hpdesktop kernel: [27909.007727] type=3D1505
audit(1283130342.751:150): operation=3D"profile_replace" pid=3D9994
name=3D"/usr/bin/evince-previewer"
Aug 29 21:05:42 hpdesktop kernel: [27909.008358] type=3D1505
audit(1283130342.751:151): operation=3D"profile_replace" pid=3D9994
name=3D"/usr/bin/evince-thumbnailer"
Aug 29 21:05:42 hpdesktop kernel: [27909.214193] type=3D1505
audit(1283130342.959:152): operation=3D"profile_replace" pid=3D10004
name=3D"/usr/lib/cups/backend/cups-pdf"
Aug 29 21:05:42 hpdesktop kernel: [27909.214394] type=3D1505
audit(1283130342.959:153): operation=3D"profile_replace" pid=3D10004
name=3D"/usr/sbin/cupsd"
Aug 29 21:05:43 hpdesktop kernel: [27909.277634] type=3D1505
audit(1283130343.018:154): operation=3D"profile_replace" pid=3D10007
name=3D"/usr/sbin/mysqld"
Aug 29 21:05:47 hpdesktop init: mysql post-start process (9910)
terminated with status 1
Aug 29 21:05:47 hpdesktop kernel: [27914.103805] __ratelimit: 3
callbacks suppressed
Aug 29 21:05:47 hpdesktop kernel: [27914.103808] type=3D1505
audit(1283130347.848:156): operation=3D"profile_replace" pid=3D10043
name=3D"/usr/sbin/mysqld"
Aug 29 21:05:48 hpdesktop init: mysql main process (10047) terminated
with status 1
Aug 29 21:05:48 hpdesktop init: mysql main process ended, respawning

Does this help? Please help me identify the problem.

Best,
Jia

On Sun, Aug 29, 2010 at 4:18 PM, chen jia wrote:
> I think so.
>
> When I run
> ls -l /var/run/mysqld/
>
> I get
> total 0
> srwxrwxrwx 1 mysql mysql 0 2010-08-29 14:45 mysqld.sock
>
>
> On Sun, Aug 29, 2010 at 4:02 PM, Sabika Gmail =
wrote:
>> Does your mysql sock file reside in the same location as the error?
>>
>>
>>
>> On Aug 29, 2010, at 12:20 PM, chen jia wrote:
>>
>>> Hi there,
>>>
>>> I install ubuntu 10.04 (64bit) on my desktop and try to move my
>>> existing MySQL data over.
>>>
>>> I first install MySQL on the new machine, and it can start and stop
>>> fine. I decide to change the data folder from the default
>>> (/var/lib/mysql) to /home/MyAccount/MySQLdata and move my existing
>>> MySQL data to that directory.
>>>
>>> Because I used to use MySQL on my laptop and set the data directory on
>>> a USB drive, my existing data is on the USB drive. I connect the USB
>>> drive to the desktop and copy the old data folder to the new data
>>> folder by using
>>> sudo rsync -av /media/USBdrive/MySQLdata/ /home/MyAccount/MySQLdata.
>>>
>>> Then, I change the ownership of the new folder by using sudo chown
>>> mysql:mysql /home/MyAccount/MySQLdata.
>>>
>>> Next, I edit /etc/mysql/my.conf and update the "datadir" to my new
>>> directory. I also update /etc/apparmor.d/usr.sbin.mysql so that lines
>>> with /var/lib/mysql are commented out and news lines with
>>> /home/MyAccount/MySQLdata are added. I reload the apparmor by using
>>> sudo /etc/init.d/apparmor reload.
>>>
>>> However, when I try to start mysql with sudo start mysql, it hangs.
>>> When I try sudo mysqld and connect to mysql by using mysql -u root -p,
>>> it complains: ERROR 2002 (HY000): Can't connect to local MySQL server
>>> through socket '/var/run/mysqld/mysqld.sock' (111)
>>>
>>> Do you have any idea what I need to test and/or do to fix this problem?=
Thanks.
>>>
>>> Best,
>>> Jia
>>>
>>> --
>>> MySQL General Mailing List
>>> For list archives: http://lists.mysql.com/mysql
>>> To unsubscribe: =A0 =A0http://lists.mysql.com/mysql?unsub=3Dsabika.makh=
doom@gmail.com
>>>
>>
>

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg