List:General Discussion« Previous MessageNext Message »
From:leegold Date:June 18 2011 9:56pm
Subject:Re: How to copy file from an old server to reconstitute a database ?
View as plain text  
I copied /var/lib/mysql and I am ready to transplant it. But when I
copied, permissions and ownership for files and dirs was not retained.
You said to be careful about permissions, could you elaborate on that a
bit more. On the original hard disk I copied from I did ls -l on some
dirs for example:

$ sudo ls -la /media/fd453d5c-81f5-9c66ff4685bc/lib/mysql
total 20513
drwx------  5 avahi-autoipd lpadmin      328 2011-06-15 17:03 .
drwxr-xr-x 39 root          root        1072 2011-05-17 04:45 ..
-rw-r--r--  1 root          root           0 2011-05-04 18:50
debian-5.1.flag
-rw-rw----  1 avahi-autoipd lpadmin 10485760 2011-06-15 17:02 ibdata1
-rw-rw----  1 avahi-autoipd lpadmin  5242880 2011-06-15 17:03
ib_logfile0
-rw-rw----  1 avahi-autoipd lpadmin  5242880 2011-05-04 18:50
ib_logfile1
drwx------  2 avahi-autoipd root        2352 2011-05-04 18:51 mysql
-rw-rw----  1 root          root           6 2011-05-04 18:51
mysql_upgrade_info
drwx------  2 avahi-autoipd lpadmin     1056 2011-05-04 19:06 phpmyadmin
-rw-rw----  1 avahi-autoipd lpadmin        4 2011-06-15 17:03
videoserver.pid
drwx------  2 avahi-autoipd lpadmin      528 2011-05-27 22:38 ws_videos

and the DB of interest:

root@ubuntu:/media/fd453d5c-81f5-9c66ff4685bc/lib/mysql/ws_videos# ls
-la
total 341
drwx------ 2 avahi-autoipd lpadmin    528 2011-05-27 22:38 .
drwx------ 5 avahi-autoipd lpadmin    328 2011-06-15 17:03 ..
-rw-rw---- 1 avahi-autoipd lpadmin     65 2011-05-04 20:10 db.opt
-rw-rw---- 1 avahi-autoipd lpadmin   8716 2011-05-27 22:38
gallery_photos.frm
-rw-rw---- 1 avahi-autoipd lpadmin      0 2011-05-27 22:38
gallery_photos.MYD
-rw-rw---- 1 avahi-autoipd lpadmin   1024 2011-05-27 22:38
gallery_photos.MYI
-rw-rw---- 1 avahi-autoipd lpadmin   8642 2011-05-27 18:16
login_table.frm
-rw-rw---- 1 avahi-autoipd lpadmin     48 2011-05-27 18:16
login_table.MYD
-rw-rw---- 1 avahi-autoipd lpadmin   2048 2011-05-28 05:24
login_table.MYI
-rw-rw---- 1 avahi-autoipd lpadmin   8622 2011-05-27 22:37
photo_gallery_category.frm
-rw-rw---- 1 avahi-autoipd lpadmin      0 2011-05-27 22:37
photo_gallery_category.MYD
-rw-rw---- 1 avahi-autoipd lpadmin   1024 2011-05-27 22:37
photo_gallery_category.MYI
-rw-rw---- 1 avahi-autoipd lpadmin   8864 2011-05-23 16:27 vid_table.frm
-rw-rw---- 1 avahi-autoipd lpadmin 254504 2011-06-12 01:32 vid_table.MYD
-rw-rw---- 1 avahi-autoipd lpadmin  18432 2011-06-12 04:20 vid_table.MYI

all this permission info is lost in the copied...

What has to be recreated per ownership and permissions and how deep into
these directories do I have to drill down to and fix regarding this? 

Aside from permissions I assume I take datadir and directly transplant
it and check that the /etc config files are OK?

Help appreciated.

Lee G.


On Thu, 16 Jun 2011 19:12 +0100, "Andrew Moore" <eroomydna@stripped>
wrote:
> Lee,
> 
> You will need to take the datadir directory, typically found under
> /var/lib/mysql/
> 
> It would also be a good idea to grab your configuration file from
> /etc/mysql/my.cnf or /etc/my.cnf (ubuntu tends to be the former).
> 
> Once transplanted into your new server remember to check that the
> permissions on the implanted files. Starting the MySQL Server Daemon
> should
> initiate the InnoDB Crash recovery procedure and you should be up and
> running again.
> 
> That's a 50,000ft overview of the process but unless you're having some
> other more serious issues with the data then the previous steps should
> get
> you working again.
> 
> A
> 
> On Thu, Jun 16, 2011 at 6:50 PM, leegold <leegold@stripped> wrote:
> 
> > Hi,
> >
> > I have a situation where the box with a mysql server will not boot. But
> > I can boot it from a CD and browse the hard drive and I can mount
> > partitions so files and data are accessible. I want to somehow take the
> > Mysql DB structure and content, copy it, and move it to a bootable
> > working unit. Normally I'd run the script that puts it "all" into a
> > comma delimited file that can be reconstituted at a later date. But in
> > my case I can only copy and paste files from an unbootable unit to a
> > working server and try to reconstitute it from there.
> >
> > It is Ubuntu 10.4 server. Is what I want to do possible? What
> > directories and files would I need to copy? First I would have a working
> > Mysql server on the new unit then I assume I would copy to the new
> > server and process the data if necessary...any help on how to proceed
> > appreciated.
> >
> > Thanks,
> >
> > Lee G.
> >
> > --
> > MySQL General Mailing List
> > For list archives: http://lists.mysql.com/mysql
> > To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
> >
> >
> 
Thread
How to copy file from an old server to reconstitute a database ?leegold16 Jun
  • Re: How to copy file from an old server to reconstitute a database ?Andrew Moore16 Jun
    • Re: How to copy file from an old server to reconstitute a database ?leegold18 Jun
      • Re: How to copy file from an old server to reconstitute a database ?Claudio Nanni19 Jun
  • Re: How to copy file from an old server to reconstitute a database ?Claudio Nanni16 Jun