Help - Search - Members - Calendar
Full Version: Restore blog from MySQL backup
Movable Type Community Forum > Additional Resources > Tips and Tricks
Talyn
Searching the forums have shown many posts asking how to backup the MySQL database with mysqldump. I set up a cronjob to do that every day on my server. However, what I have not seen yet is a way to start with a fresh install of MT and have it 'back to normal' with the MySQL backup.

The server my blog is hosted on is going to be moving to an alpha cluster sometime in the next two weeks, and it would certainly be nice this time to just be able to install MT then run a command or few that resets the blog to the most current version of the MySQL backup...
LisaJill
With PHPMyAdmin, you can go to Query Window - > Import Files, then enter in the location of the text file from your PC.

I've never done this, but it looks like the way to get it going.

Not sure without phpmyadmin sad.gif
Talyn
I'm not allowed to install PHPMyAdmin on my space so that won't be an option.

Looks like a full manual backup will be in order (again) and frankly, if that's the case, what's the point in backing up the MySQL tables to begin with if I can't use it for a restoration?
LisaJill
Talyn,

My knowledge of databases is limited. If you have mySQL and a way to run queries (command line or whatever you use) then there IS a way to import.

PHPMyAdmin is simply a front-end to the massive power behind it. Much like anything that comes close to, or is, point and click.

Just because *I* don't know how, doesn't mean there isn't a way. Try googling for 'importing into mysql' I am sure that a little research will turn up hundreds of ways to do it.
charle97
can you backup the database itself without phpmyadmin?
LisaJill
Of course you can.

The MTWiki has instructions on doing so via command line and/or cron.

It also has a link to the mysql documentation, where you can find information on importing.
charle97
i was asking talyn if she had the ability to do so, not in the general sense. if cpanel is used, restoring a table dump is more complicated than a simple restore of a zipped db backup.
LisaJill
Talyn said in his/her first post that they're doing it by cron, so that'd be command line. I don't think you can set off phpmyadmin via cron, tho I could be mistaken, since - as I admitted to earlier, I know very little about sql databases =)
charle97
well, talyn's hosting provider should have a mysql manual available somewhere for easy lookup on database restoration.
oscarf
I'm not sure if I'm missing something here, but isn't this the easiest thing in the world? First you make sure all your MT installation files are installed as they should be. Then, you've copied your backup file to the new server, and on the command line you type:
CODE
mysql yourblog_database_name < backupfile.sql

Then log into MT, adjust file paths in configuration if necessary, rebuild, and you're good.
Talyn
I'm male, just to set the record straight smile.gif

Yes, I can export and import the MySQL databases easily, that's not what I'm after though.

My site will be moved to a whole new machine in a matter of days, and I would like to simply import the MySQL backup and have MT recognize it instead of having to export/import all the entries and essentially do a manual full reinstall of MT, manually import the entries, templates, archive settings, overall configuration... you know... all the stuff that's already in the MySQL backup... tongue.gif
charle97
QUOTE (Talyn @ Dec 22 2003, 07:54 AM)
Yes, I can export and import the MySQL databases easily, that's not what I'm after though.

the above method is what i've used a number of times when recovering from a problem or moving to a new host.
Talyn
I tried it a few weeks ago: imported the MySQL tables from the backup, fired up a fresh MT and... it had no clue there was anything in the database. I wound up dropping all the tables and starting from scratch. (Luckily I have all my posts offline, but I hadn't done an entry export).
oscarf
I've made the move many times, and importing the database from backup works just fine. No need for all that other stuff you've mentioned. The key is to be sure your data is really being imported (and exported), to be sure the databse name is correct and reflected in mt.cfg, and to be sure your paths are all correct. We can help you with this wehn the time comes, if you like. Just be sure you have a mysqldump file that is good.
charle97
make sure database related variables in your mt.cfg file match your database name and database user. don't forget about the password file either.
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-2009 Invision Power Services, Inc.