WordPress Database Backup Question - mysql

I am working on a charity site and was tasked with moving a WordPress site to another host from Yahoo hosting. I have done this before and thought it would be easy enough.
Before moving the site I backed up all the files and backed up the database. The files are fine, but the database backup has me stumped.
I ended up with the following file: mysqldata.2009-09-20-18-37.tar.gz
I thought I was in good shape and could just import the file using PHPmyAdmin, however, when I unzipped the file it is not a sql file at all but has the following structure:
blog
mysql
Within the mysql director it has a list of files like this:
user.MYI
columns_priv.frm
columns_priv.MYD
columns_priv.MYI
db.frm
db.MYD
db.MYI
func.frm
func.MYD
func.MYI
host.frm
host.MYD
host.MYI
tables_priv.frm
tables_priv.MYD
tables_priv.MYI
user.frm
user.MYD
Is there some way I can restore the database with the information in this form?
Thanks!

On your new database server, create the new database, e.g. CREATE DATABASE my_wordpress_blog
Copy these .MYI, .MYD and .frm files to wherever MySQL stores the files for this database, e.g. /var/lib/mysql/my_wordpress_blog/
This will probably only work if the version of MySQL on your new server is the same or newer than your old server.

Hy if you have shell acces to the server just do
`mysqldump db_name backup-file.sql`
And restore the db in phpmyadmin.

Might also consider using the WordPress Tools->Export at the old blog and Tools->Import->WordPress at the new blog.
Or installing a plugin that will create a backup you can restore from within phpMyAdmin.
http://wordpress.org/extend/plugins/wp-db-backup/

Related

Restore SQL database for WordPress

Unfortunately my VPS got corrupted and therefore I wasn't able to perform an export of the sql database with phpmyadmin. I do managed to copy all the SQL files .frm, .idb, .opt etc
Is it possible to recover the database and make my wordpress site working again?
Im using centos7 with Plesk Onyx / phpmyadmin
Absolutely! First get a new instance of your VPS running and create your database again, after created copy the .idb(innodb) or .myi/.myd(mysami) files right back where you found them
Each table comes with a .frm, don't forget those, as well as a db.opt for the database
Typical mysql storage (on linux) is located:
/var/lib/mysql/database_name
Once copied over restart mysql and check again

WordPress Error establishing a database connection (xampp)

I am using xampp to host my website local. I am making a WordPress site with the MySQL database from xampp.
Now, I bought a new computer and took backup of my WordPress folder. Now when I try to open my WordPress site on my new computer, I get the error: Error establishing a database connection
I can image this is because the database that is linked to the WordPress site is not on my new system.
I formatted my old drive so I cannot restore the old database. Is there a work around?
If you have your old database file (.sql) then you can just
Run this link from your browser http://localhost/phpmyadmin.
Select Database which you want to upload the SQL file. (If no DB , create new database).
Click on Import option from top menu section and upload you files.
and for taking backup of your database on Xampp
1. Run this link from your browser http://localhost/phpmyadmin.
2. Select Database which you want to take backup of.
3. Click on Export option from top menu section and backup your files.
If your old drive is completely formatted, and you weren't using any sort of Wordpress backup plugin, then no, you won't be able to rebuild the site. Sorry! As well as storing your content (posts / articles), your Wordpress database also stores information on which plugins you were using, so it is an critical part of rebuilding any Wordpress site.
Next time around, you should export your database to a file (eg .sql), so you can import it on your new server/laptop. You would achieve this by either using a Wordpress plugin, or on XAMPP by using phpMyAdmin. You could also do this with 3rd party apps, like SequelPro or MySQLWorkbench.
You should have your images and static assets saved - eg css files, uploaded images, so you have something to start with, if you decide to rebuild your site without the database.
You need to install your wordpress site again with new database. You already lost it. Always backup your wordpress site.
You can backup your wordpress site with this plugin and it's free-
https://wordpress.org/plugins/updraftplus/
Thanks
BanyanTheme
Step 1: Backup your database on the old computer.
Step 2: Restore the database onto the new computer.
Step 3: Run file install in wordpress
Good luck!

Exporting a table without using phpMyAdmin in MAMP

I have been working on a web application using ExtJS with a SQL Database hosted on phpMyAdmin using MAMP. About 2 weeks ago, I had to dump my old HD because of bad sectors and I got an SSD as a replacement. After installing my applications again (IDE's, Document Editing Softwares, MAMP, etc), I had to reinitialize my databases in phpMyAdmin.
Luckily, I had one of them online in production so I just exported the SQL from the server and I had a local copy again. However, there's this one other website that I do not have a backup to the SQL file of -- and I need to get that SQL file because I can't create it from memory (I think it had 30+ tables already).
I know I can plug in my old hard drive, boot from there, open MAMP, open phpMyAdmin, then export my database. However, that's too much work and I am not sure if that's a good idea.
Is there a way to extract the SQL file of a phpMyAdmin table by using the file directory/structure alone? I think MAMP is supposed to store the data somewhere so that phpMyAdmin knows where to get its SQL tables.
Update
I found my "database" under /Applications/MAMP/db/mysql/ProjectName/ but they're .frm and I'm clueless on how to open this.
Take a look at this answer: Restore the mysql database from .frm files
You'll need a couple more files other than the .frm, but you can solve it with the files alone, no need to plug in your old drive again.

I Want to use a mysql database from a backup of a non-working server on a new computer

My database is from a backup of the non-working server.
My database is the teachercenter folder that was on the server, and contains files for each table name with the extension *.frm.
I copied the database from:
C:\Users\xxx\Downloads\wamp-saved\wamp\bin\mysql\mysql5.1.36\data\
And pasted that folder on my computer here:
C:\wamp\bin\mysql\mysql5.6.17\data
I realize the the two mysql's were different versions, but I'm just trying to use the database files.
When I start up PHPMyAdmin on the new computer, it shows the teachercenter database in the list of databases.
Also, if I click the plus next to the teachercenter database, I can see a list of my database tables!
But if I click on teachercenter database itself, I get error:
No tables found in database.
How do I get mysql to recognize and let me operate (PHPMyAdmin) on the teachercenter database on the new computer?
I tried to start/use wampmanager.exe, but I don't see it running to use it's menus.
THE PROBLEM IS SOLVED:
At: stackoverflow.com/questions/10934745/… a simple answer to my probelem is given, as follows: "Yes this is possible. It is not enough you just copy the .frm files to the to the database folder but you also need to copy the ib_logfiles and ibdata file into your data folder." I copied the ib_logfiles and ibdata file into my data folder, and Voila! PHPMyAdmin was completely happy with the database and its tables and I could do SQL exports of table records.
Summary: To make use of a MySQL database of *.frm files that your MySQL doesn't understand, simply copy the ib_logfiles and ibdata file from whereever you got the .frm files from, and put these two files in the data folder next to the database you want to use. Once you do that, the MySQL database engine will recognize your database, and you can all PHPMyAdmin operations on your fully operational database.
Because you can't be sure that the MyISAM storage format backwards compatible, your safest option is to install MySql 5.1.36, use mysqldump to export your entire database to plain SQL, install MySql 5.6.17 and then import your data using SQL.
Also, this probably gives better results because your indexes are rebuild.

How to manually import database directly into the data folder in phpMyAdmin in XAMPP?

I recently installed a new version of XAMPP. I copied and pasted database folders from the old xampp's mysql/data to the same folder in the newer version. The database names are displayed in phpMyAdmin but it does not show any data.
I know I can do a simple import/export sql to resolve this but I'd like to know why copying and pasting the database folders not working? Do I have to do something else in order to make this work?
I'm going to backup my database regularly using an auto backup tool. Apart from backing up mysql/data folder, do I also need to backup some other folders or files to have a proper database backup?
why copying and pasting the database folders not working? >> as far as I know we need to use import feature, because it will register the database to mysql's infomation_schema.
So even if the database file is stored in the correct folder, it won't show up on the phpmyadmin because it's not registered. And I think mysql didn't do any directory scanning to determine it's database line up.
To back up automatically, there are several ways you can do. Moreover if you use linux OS, you have more freedom to do that, for example create a php script to backup your db and then execute it regulary by using cron job.
hope this can help you.