LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 02-05-2010, 09:28 PM   #1
bbrian017
Member
 
Registered: Dec 2009
Posts: 59

Rep: Reputation: 15
USB enclosure MySQL data dump and file access


Operating System: CentOS 5
Processor: Intel Pentium 4 - 3.0 GHz
RAM: 1 GB
Total Disk Space: 120 GB
RAID: None
Bandwidth Quota: 500 GB

My server recently crashed and now I'm reprovisioning a new hard drive.

I paid the 150 USD to have a USB enclosure of the old hard drive.

How do I perform the following?

Export mysql from the websites on the hard drive?

EDIT: I found it.

EXPORT

Code:
# mysqldump -u username -ppassword database_name > FILE.sql
IMPORT

Code:
# mysql -u username -ppassword database_name < FILE.sql
BUT Where does this stuff get exported to?

How do I move it from the old hard drive to the new one?

So far I understand I have to mount the hard drive on to my new hard drive.

Code:
mkdir /olddrive
mount /dev/sdb3 /olddrive
I can use all the help if anyone has some free hanging around and helping time.

I figure if I can get help with the first website the other 8 will be no problem...

Last edited by bbrian017; 02-06-2010 at 09:14 AM. Reason: added server specs!
 
Old 02-06-2010, 09:52 AM   #2
bbrian017
Member
 
Registered: Dec 2009
Posts: 59

Original Poster
Rep: Reputation: 15
I managed to successfully mount the hard drive and visit it's /home/ root

Please see attachment.

Questions

Am I looking at the sql data or physical files such as html, tpl, and php?

If it's SQL Data how do I see the physical files such as html, tpl, and php?

If it's the physical files such as html, tpl, and php how do I see the sql data?

I ran this,

# mysqldump -u username -ppassword database_name > blogengage.sql

It seem to have worked but I'm not sure where it put blogengage.sql

Thanks,

Brian
Attached Images
File Type: jpg root_old_drive.jpg (25.6 KB, 6 views)
 
Old 02-06-2010, 10:03 AM   #3
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,017

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
All those files listed in blue are probably directories.
If you have lost blogengage.sql then you can use locate to find it. First update the database, then use the command, like this:
As root:

Code:
updatedb     # wait a while then, when the prompt comes back:
locate  blogengage.sql
It'll tell you where it is.

If you are sure it is on the olddrive then you could just
Code:
find /path/to/olddrive -name blogengage.sql
and it'll print the path to the file, if it exists, otherwise, nothing happens.
 
1 members found this post helpful.
Old 02-06-2010, 10:45 AM   #4
bbrian017
Member
 
Registered: Dec 2009
Posts: 59

Original Poster
Rep: Reputation: 15
Thanks so much for the help tredegar

I have successfully managed to import the old hard drives sql files into my new linux server. (8 more websites to go lol)

Now I could really use some help with moving the physical files from the old drive to the new drive.

Any advice?
 
Old 02-06-2010, 10:51 AM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,017

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Quote:
Now I could really use some help with moving the physical files from the old drive to the new drive.
You are joking? Use the copy command:
Code:
cp /path/to/source  /path/to/destination
cp has lots of options, depending if you want to preserve permissions, timestamps etc.
Code:
cp -a /path/to/source/*  /path/to/destination/
is an option I find useful.

man cp for all the gory details

Don't delete any files until you are sure you have done it all correctly (which means use cp not mv or rm !)
 
1 members found this post helpful.
Old 02-06-2010, 11:08 AM   #6
bbrian017
Member
 
Registered: Dec 2009
Posts: 59

Original Poster
Rep: Reputation: 15
I'm sorry I really am an extreme noob! I thank you for helping because Google search is full of unrelated content. Much black hat seo!

When I do the command

Code:
cp olddrive/home/root/blogengagenew  home/root/blogengage
I'm getting

Code:
cp: cannot stat `/olddrive/home/root/blogengagenew': No such file or directory
How can I find the actual location of my files in blogengage

I thought it would had been cp olddrive/home/root/blogengagenew

or maybe even olddrive/home/root/public_html/blogengagenew

Thanks,

Brian

Last edited by bbrian017; 02-06-2010 at 11:18 AM.
 
Old 02-06-2010, 11:20 AM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,969

Rep: Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752
I assume you installed CentOS from scratch on the new drive and want to move the old data form the USB drive to the new one. Unless your booting from the old drive mysqldump is not going to dump the correct data. The default data location is /usr/local/mysql/var/. I am not real familiar with mysql but assuming your old system was kept updated you might be able to get away with copying the data and configuration files.

FYI. mysqldump exports a database by generating SQL commands i.e. create, insert. It is a plain text file.

home should contain all your users home directories. CentOS default html directory is /var/www/html which is also where the rest of your files are probably located. What web application are you running?
 
1 members found this post helpful.
Old 02-06-2010, 11:23 AM   #8
bbrian017
Member
 
Registered: Dec 2009
Posts: 59

Original Poster
Rep: Reputation: 15
Yes I'm trying to change the path of the old php and tpl files to the new hard drive!

I think my web application is simple control panel or do you mean SSH?

Thanks for the insight by the way.

EDIT:

When I'm in var/www/html/ I use LS and it's not showing anything...

Last edited by bbrian017; 02-06-2010 at 11:32 AM.
 
Old 02-06-2010, 11:43 AM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,969

Rep: Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752
I assume you are running cpanel.
 
Old 02-06-2010, 11:47 AM   #10
bbrian017
Member
 
Registered: Dec 2009
Posts: 59

Original Poster
Rep: Reputation: 15
It's called simple control panel from godaddy! It's very basic! Most of everything still has to be done using SSH.

Right now I'm trying to find the actually html, tpl and php files on my old drive so I can change it's location to my new hard drive.

Code:
cp olddrive/home/root/public_html/blogengagenew  home/root/public_html/blogengage
Code:
cp olddrive/var/www/html/blogengagenew  /var/www/html/public_html/blogengage
So far I only got this message,
Code:
cp: cannot stat `/olddrive/home/root/blogengagenew': No such file or directory

Last edited by bbrian017; 02-06-2010 at 11:50 AM.
 
Old 02-06-2010, 11:51 AM   #11
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,017

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Missposted
 
Old 02-06-2010, 12:10 PM   #12
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,017

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Sorry about post #11, I hit return and the unfinished post got uploaded by accident. [Mistakes can happen, see below].

I think you are getting lost because you do not know any basic bash commands, and you do not know your way around the filesystem.

You are in a very dangerous situation:
- You are running as root (one tiny typo and all your data can be gone!)
- You do not know what you are doing
- In a situation like this it is very very easy to make a complete mess of things, from which you cannot recover

If these databases and websites are valuable or important to you, I suggest you get a professional to help you, or have very good backups and you are confident you know how to restore from them.

For example, if your USB drive holds all your website & database data, it would have been a very good idea, when you mounted it, to mount it as "Read Only" - That way it is much more difficult to delete your data before it has been safely copied over.

I also fear you are about to run, at full speed, into a shedload of problems with UIDs, GIDs, ownerships and permissions.

Please, get help.

[Where did this system come from? I very much doubt you installed it. I mean this nicely, as perhaps the person who installed it can help you out].
 
1 members found this post helpful.
Old 02-06-2010, 12:11 PM   #13
bbrian017
Member
 
Registered: Dec 2009
Posts: 59

Original Poster
Rep: Reputation: 15
Perhaps the files are not there.

I use this,

Code:
/olddrive/home/
I can see all my directories!

For some reason I can enter some and I cannot enter others.

If I try to enter my blogengage one

Code:
/olddrive/home/blogengagenew
Code:
-bash: cd: /olddrive/home/blogengagenew: Not a directory
But as mentioned if I got into another directory.

Code:
/olddrive/home/blogserp
When I use ls I see cert and public_html

Why can I not access some of the directories?
 
Old 02-06-2010, 01:01 PM   #14
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,017

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Quote:
Why can I not access some of the directories?
Did you read my post at #12 ? You did not answer any of my questions.

This is a case of
Quote:
I also fear you are about to run, at full speed, into a shedload of problems with UIDs, GIDs, ownerships and permissions.
So, as I said, please get help.
 
Old 02-06-2010, 01:02 PM   #15
bbrian017
Member
 
Registered: Dec 2009
Posts: 59

Original Poster
Rep: Reputation: 15
Alright I cannot seen to actually find the blogengage directory.

If I do the command



Does this mean I don't have the directory?

It turns out the blogengagenew in the attachment above is actually a file and contains rsa keys. I don't know what that is about! I cannot seen to locate my blogengage files.

@tredegar sorry I don't answer your questions it's pretty hectic in my pc chair right now lol

Godaddy is the company that installed my new server.

The odd thing is the folder structure should be the same for all websites.

They were all installed in a home/foldername/public_html

Some are directories some are not it's so strange for me!

Last edited by bbrian017; 06-05-2010 at 12:20 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I get data out of MySQL if I can access the HD, but not run MySQL DJOtaku Linux - Server 4 01-11-2009 07:30 PM
need to get data from xml file to MySQL database, and then use php to access Armon Linux - General 1 01-18-2006 02:54 PM
USB LexarMedia 32MB Data-Key + KDE 3.2=USB/HD Access problems that_guy Slackware 0 02-03-2005 08:27 AM
Dump all uploaded data to stdout or file (DSL, PPPoE) hansschmucker Linux - Networking 0 10-21-2004 06:43 PM
How do I get a dump file (.sql) into MySql? TreeDragon60 Linux - Software 4 03-21-2004 05:19 AM


All times are GMT -5. The time now is 02:07 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration