Help - Search - Members - Calendar
Full Version: Linux commands needed
The Planet Forums > Operating Systems > Red Hat Linux
Lady Domini
Hi,

I've been a minor webmaster for a few years, but I'm new to actually dealing with a server beyond FTPing something up and setting permissions on the webpages.

We just moved servers, and phpmyadmin sucks to download large databases. AFAIK I need to SSh in and do what needs to be done that way.

My problem is I don't know the linux commands to do it.

How would I dump a mysql database? I tried it earlier with this command:

%>mysqldump -u myusername -p --opt oentalox_com

and on putty it flashed the dump at me, but I don't know where it dumped it (that is if it actually dumped it and didn't just flash it at me on the screen), or how to run the command and tell it to dump it in a specific place.

So, that's my first question. Can anyone help me with that?

Second question is, once I've gotten the database dumped, and I know where to find it, is it ok to download it to my machine then FTP it back into place on the new server? I'm much more familiar with FTP than Linux, so if I can do that, it'll make it easier for me on a personal level.

Third question. Where on the new server do I put it? And what command do I give it so it will populate my new database?

If anyone could give me help on that, it would utterly rock. All I really need is the command line that would do it, with an explanation of the terms and flags used. Once I learn it once, I'll remember it...I just need to learn it the first time. I basically have all of the rest of my files moved over except for my mysql database, and I've been at least 8 hours trying to figure it out on my own, but without guidance it's just too hard and I'm ready to go on a murdering rampage. killkilllkillkillkillllll....

And if it helps anyone to answer, I'm a virtual site on a dedicated server running redhat and ensim pro.

Thanks! icon_smile.gif
newuser
Your command would dump it to screen.

to send it to a file, append this to the end:

> file.txt

That will send it into file.txt

As far as your other questions, it doesn't matter where you upload the sql dump, as you can run the upload command from anywhere...
Lady Domini
You rock. Except...where would file.txt be located? Root? Somewhere else? I really am a linux n00b. Hopefully not for long though.

Edit: Nevermind. For those who want to know (other newbies icon_biggrin.gif ) it dumped it in /home/webmaster (my username is webmaster on the oentalox.com domain). Basically, when I FTP in with filezilla, it's right there. ::happy dance::

Now, how would I tell Linux to find where I put the file and to execute the commands and make the tables and insert the data in my database on the new server?
jahsh
mysql -f -u root -p DATABASE < filename.sql
Err0r
Personally I find that dumping a db to file is only useful to a point. For large databases the dumping uses more cpu time and ram to dump and reload the db. I just go to /var/lib/mysql and tar the directory for the db I want to copy/dump. Then when I move it to a new server I just stop mysql, untar and restart mysql. It always works without a problem.
Aurelius
Yes, it would dump the db wherever you currently are, if you were in /home/user it'd dump it in /home/user, if you were in /blablabla it'd dump it in /blablabla

=P
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.