473,513 Members | 4,001 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

restore multiple databases with command line

32 New Member
On my site I do a weekly backup of our server and the mysql databases. The problem I am having is restoring / updating the backup server's mysql data. There are 2 databases that I need to restore / update on the new server, but only 1 sql file, and I havent been able to find a tutorial on how to restore both databases with the command line.

and I dont think this makes a difference, but the server is running on a Ubuntu Linux Distro.
Oct 22 '07 #1
9 5842
jgentes
32 New Member
anyone have an idea of how to accomplish this?
Oct 24 '07 #2
Atli
5,058 Recognized Expert Expert
Hi.

You have posted this in the MySQL Articles section. I have moved it over to the MySQL Forums where our members will find it.

Please try to avoid posting questions in the Articles section in the future.

Moderator
Oct 24 '07 #3
jgentes
32 New Member
can anyone help with this? please? thanks

I have looked all over and I cannot seem to find out how to do this
Oct 29 '07 #4
Atli
5,058 Recognized Expert Expert
Hi.

How exactly are you creating your backups?
Oct 29 '07 #5
jgentes
32 New Member
How exactly are you creating your backups?
Expand|Select|Wrap|Line Numbers
  1. /usr/bin/mysqldump --all-databases --password=_pass_ > \_path_/file.sql
  2.  
Nov 1 '07 #6
mwasif
802 Recognized Expert Contributor
You want to backup all the database in SQL file but update only 2 of them to the other server. Right? Is it not possible for you to make 2 backup sql files?

I can't see any method to restore only selective databases from the SQL file.
Nov 1 '07 #7
jgentes
32 New Member
there are only 2 databases to update. the reason I chose to dump them all is because its less code, and I figured there would be a way to import the whole sql file to the mirrored server since this isnt some miracle "hack" I devised to trick the system.

maybe it would be better just to dump each database separately I dont know :-s what do you guys think?
Nov 2 '07 #8
mwasif
802 Recognized Expert Contributor
the reason I chose to dump them all is because its less code
How many databases you have on the actual server that you are dumping? If you have only 2 databases, then you can use the single sql file to update both databases on the other server. Simply use the mysql command on the shell to update the database on the other server, it will update the other database as well.
Expand|Select|Wrap|Line Numbers
  1. mysql db_name < dumped.sql
Because sql file contains
Expand|Select|Wrap|Line Numbers
  1. USE db_name;
which use the appropriate database to update the data.
Nov 2 '07 #9
jgentes
32 New Member
okay I did that and now I am getting

Expand|Select|Wrap|Line Numbers
  1. ERROR 1217 (23000) at line 243: Cannot delete or update a parent row: a foreign key constraint fails
  2.  
Expand|Select|Wrap|Line Numbers
  1. line 243: DROP TABLE IF EXISTS 'downloads';
I checked on the mysql dev site and I cannot seem to figure out how to solve the problem? maybe it's just my lack of expertise in this area?

Thanks for any help in advance.
Nov 7 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
15450
by: James | last post by:
HI, I'm looking for a script that will allow users/admins to have a one click backup solution for a MYSQL Database.. 'BACK DATABASE' button, click and its done... The a restore option, that shows all current backups, and restores the selected one with one click...
0
2060
by: barbara | last post by:
I am using this procedure from net for getting the restore script. It lists the latest full backup file name and logs after that point. Is there any way to modify this script to take either date or time as parameter and give the files for restore? I need this if I need to restore the data up to last week/upto some point of time. CREATE ...
11
13480
by: Chris | last post by:
I have searched this group for answers and tried the responses. I am trying to Use an full online backup from our production server and apply it to our test server. The Tablespaces in the productions server are on the d drive and my test server has no d drive. The restore command i am using is: RESTORE DATABASE CENTRAL FROM...
3
11478
by: cefrancke | last post by:
The only reason I ask is that no one has made this subject clear or given a definitive answer. What I would like to do is, after turning off all the menus/tbars/etc using the startup options. Upon restarting Access, when an admin is detected (I use a GetSystemUser() function) I want to restore everything so that Access behaves like...
3
1705
by: ReeseDog | last post by:
First time DB2 user here. I have a backup from a unix box around 8.1. I am trying to restore this backup on a windows box 8.2 (demo version) I am not sure how the original backup was created but according to the file path it looks like it is a full backup. When using the wizards, i cannot seem to view the backup and i have got several...
0
3866
by: MikeB | last post by:
Problem : I am maintaining a legacy application which is distributed with a default database, loaded from a file called Master.dat. I wish to update the values of 10 fields in 1 table. I can restore a database from Master.dat within the (C++ and SQLDMO) app. If I try to restore from command line osql, the restore fails :
4
5545
by: Laurence | last post by:
Hi there, Command Reference book stated for db2relocatedb command: Copy the files/devices belonging to the databases being copied onto the system where the new instance resides. The path names must be changed as necessary. However, if there are already databases in the directory where the database files are moved to, you can mistakenly...
1
7009
by: nikb | last post by:
I am trying to restore a SQL Server database from a .dat file. An earlier question on how to do this elicited the following answer. " You need to know how the '.dat' file was created in order to import it. Use RESTORE FILELISTONLY to determine if this is a database backup: RESTORE FILELISTONLY FROM DISK='C:\MyDatabase.dat'
1
5206
by: mlaris | last post by:
Howdy, We are experiencing a bizarre problem under Linux attempting to restore a DB2 database. The backup was created on this machine, and is being restored to the same machine, but changing the name of the database, and redirecting the tablespaces. The system is running DB2 Express C V9.5 and RHEL5 with latest updates The restore...
0
7270
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7178
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7397
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7563
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
4757
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3252
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3239
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.