I just tried this in Ubuntu 10.04 and I couldn't navigate to the the /var/lib/mysql directory as non-root and the sudo cd /var/lib/mysql command didn't work so I just did a sudo -s and then navigated to the directory and did a copy like you have and it worked. As the others said though, I'd do a mysqldump instead.
--- On Thu, 8/12/10, keith smith <
klsmith2020@yahoo.com> wrote:
From: keith smith <
klsmith2020@yahoo.com>
Subject: Linux CP command
To: "Main PLUG discussion list" <
plug-discuss@lists.plug.phoenix.az.us>
Date: Thursday, August 12, 2010, 6:17 PM
Hi,
For some reason I just don't get the cp command. Maybe it is the deep rooted MS DOS from the 80's and 90's. I spent about a decade using MS DOS.
Here is what is going on. I am in a CentOS box and do not ever become root. I use sudo.
I want to copy one MySql DB to another so I can use the data for testing.
1) I cd to /var/lib/mysql
2) I can see both DB's
3) I issue any number of commands that do not work.
Lets say DB1 is the source directory & DB2 is the destination directory
mysql]$ sudo cp DB1/*.* DB2/ Results: cp: cannot stat `DB1/*.*': No such file or directory
mysql]$ sudo cp DB1/* DB2/ Results: cp: cannot stat `DB1/*': No such file or directory
mysql]$ sudo cp DB1/ DB2/ Results: creates the directory DB1 under DB2 and copies all the files
into DB2/DB1
mysql]$ sudo cp DB1 DB2/ Results: does not seem to do anything.
http://www.computerhope.com/unix/ucp.htm shows this example: cp -r /home/hope/files/* /home/hope/backup
mysql]$ sudo cp -r /var/lib/mysql/DB1/* /var/lib/mysql/DB2 - cp: cannot stat `/var/lib/mysql/baseline/*': No such file or directory
This is driving me crazy. Any help much appreciated!
------------------------
Keith Smith
-----Inline Attachment Follows-----
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss