I'm very new to servers and databases, my experience spanning only a few installations of XAMPP for easy website testing and exploration. So I have XAMPP installed on my laptop, and I just put it on my netbook. I copied & moved my htdocs folder (soon to be synced with dropbox), and now need to move the database.
I am not looking for an extensive backup solution. What is the simplest way to copy my db setup on one XAMPP stack to another?
Run scheduled backup of MySQL databases as well as local files and folders Compress and encrypt backups Store backups on a network folder, FTP server or in the cloud (Amazon S3, Google Drive, Dropbox, Box, OneDrive). Backing up a database is an IO intensive process and backing up to a FTP location even if it is represented as a local drive will probably be very slow. Even if the performance is adequate for your purposes, FTP connections can be unstable and can be interrupted for a variety of reasons.
The easiest way is probably by using phpMyAdmin, which is installed as part of XAMPP.
In a browser, open
Click on export
Select your database(s) from the list
Tick the save as file box at the bottom of the page.
Click Go
Your database(s) will be exported as an SQL file, which you can use to re-create them on your other machine. Copy this file to your laptop.
In a browser, open
Click on import
Browse to the file you just exported.
Click Go
LukeRLukeRYou can use the built-in function of mysql to do this.
If you have direct access to your mysql server by typing mysql
into your console you can do some backups.
Copy the .sql file to the new computer/place and do the following.
Matt SimmonsAnother alternative might be to use the MySQL Workbench
You can probably copy your database directory inside your laptop's XAMPP mysql data directory, and paste that (or replace) in your netbook's XAMPP mysql data directory.
Also make sure to copy the individual data files like 'ibdata1' inside the data folder. This worked for me when i had to move databases across 2 XAMPP versions in my PC.
Your Ubuntu Server is up and running with a LAMP stack in your data center, and on that server runs a database (or multiple databases) that must be backed up. There are various software options you could install to make that happen, but if you want to keep that server platform down to the bare minimum to avoid possible issues, chances are you'll want to work with the built-in tools to perform the backup. It's a good thing the developers of MySQL thought of that.
I'll walk you through the process of backing up your MySQL databases without having to install third-party software. (Note: The process is the same for any Linux distribution with MySQL installed.) With this skill under your belt, you'll be able to script your own automated backups with the help of bash and cron.
SEE: Data Backup Policy (Tech Pro Research)
If MySQL is up and running, you have all the necessary software. To pull off this task, you will need the password for the MySQL user that has permissions to access the database(s) in question.
The command that does the heavy lifting is mysqldump. The command's structure looks like this:
The process is quite simple. Let's say you have a database named products, and you want to back it up to an external drive mounted at /mnt/backups/. The basic command to run that dump (aka backup) would be this:
There are a couple of issues at hand. First and foremost, you must use the -p option; this instructs mysqldump that you will be entering the password associated with the MySQL user. If that fails (depending upon your setup), you may have to include the option to instruct mysqldump which user has said permission, like so (USER is the actual user that has permission to work with the databases, such as root):
Another issue might appear if the user doesn't have write permission to that directory; if this is the case, you will receive a Permission denied error. If you don't want to run the risk of opening the permissions on that backup directory, you can first issue the command sudo su and then run the mysqldump command. Remember: After completing the task, exit out of the root bash prompt with the exit command.
If you want to back up all of your databases, you can accomplish this with the —all-databases option, like so:
If your database is considerably larger and you plan on manually running backups on a daily basis, you might consider compressing the backups. This is another feature the developers of MySQL rolled in.
Let's stick with our same example as above, only with compression. To accomplish this, we'll use the -C option, like so (USER is the username that has permission to work with the databases):
The above command will dump a compressed version of your database backup in the defined file (in this case products.sql.tgz).
You're ready to continue the work. In a future article, I'll explain how to automate the process of backing up your databases, as well as how to restore a database from a backup. If you'd rather run your backups manually, you now have all you need to do so.
DevOps, virtualization, the hybrid cloud, storage, and operational efficiency are just some of the data center topics we'll highlight. Delivered Mondays and Wednesdays
Sign up today Sign up today