Announcement

Collapse
No announcement yet.

[SOLVED] Copy mysql from one partition to another...

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] Copy mysql from one partition to another...

    I borked my 10.04 install and created another partition and now have 10.10 installed there. On the previous install, I had XAMPP for linux installed and have one database, or all for that matter, I would like moved to the new partition/install. (XAMPP already installed)

    I found this on UbuntuForums:
    Code:
    Stop MySQL with "sudo /etc/init.d/mysql stop". Make a backup of the current (clean) MySQL data directory with "sudo cp -Rp /var/lib/mysql /var/lib/mysql.backup". Then copy the old data directory from the old drive with "sudo cp -Rp /mountpoint/var/lib/mysql /var/lib/mysql", where "mountpoint" is the path to the mount. Now restart MySQL with "sudo /etc/init.d/mysql start". With any luck, MySQL should restart, and you should have your old databases back.
    ...but for me, the path is: /opt/lampp/var/mysql/

    The previous partition was on sda1 and the new is on sda6.

    I have tried many variations but I just cannot get the mountpoint right, or at least when I try, I get the "No such file or directory" error.

    I have tried:
    Code:
    sudo cp -Rp /sda1/opt/lampp/var/mysql/ /opt/lampp/var/mysql/
    cp: cannot stat `/sda1/opt/lampp/var/mysql/': No such file or directory
    and
    Code:
    sudo cp -Rp /dev/sda1/opt/lampp/var/mysql/ /opt/lampp/var/mysql/
    cp: cannot stat `/dev/sda1/opt/lampp/var/mysql/': Not a directory
    Any suggestions?

    thanks...

    #2
    Re: Copy mysql from one partition to another...

    You need to mount the other partition first, giving it a mount point. Then, referencing the mount point in your commands, it will work.
    Windows no longer obstructs my view.
    Using Kubuntu Linux since March 23, 2007.
    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

    Comment


      #3
      Re: [SOLVED] Copy mysql from one partition to another...

      Thanks Snowhog! That was what I needed.

      Here is what I ended up doing, that worked:

      Code:
      sudo mount /dev/sda1 /mnt
      
      sudo cp -Rp /mnt/opt/lampp/var/mysql/smf111 /opt/lampp/var/mysql/
      
      sudo cp -Rp /mnt/opt/lampp/var/mysql/smf_nuke /opt/lampp/var/mysql/
      
      sudo umount /mnt
      smf111, and smf_nuke are the names of the 2 databases I needed moved.

      hmmmmmm... I guess this would be the way to copy anything from one partition to another using command lines.

      THANKS AGAIN!!!

      Comment


        #4
        Re: [SOLVED] Copy mysql from one partition to another...

        Happy to help.
        Windows no longer obstructs my view.
        Using Kubuntu Linux since March 23, 2007.
        "It is a capital mistake to theorize before one has data." - Sherlock Holmes

        Comment

        Working...
        X