473,765 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Restoring a database from shell and sql dump

Does anyone know where I can find information on how to setup my shell in
unix/linux to allow me to restore a database from an sql dump...

Example...

I have a database on 83200.mysql.com (example) that I have a file mysql.sql
(also just an example).

The file was produced using an sqldump command from a web interface...

How can I configure a connection if I am not on 83200.mysql.com so that I
can import the data into a database with a name of database_wordpr ess

Any help is greatly appreciated.

Sep 22 '05 #1
1 3896
>Does anyone know where I can find information on how to setup my shell in
unix/linux to allow me to restore a database from an sql dump...
You need to install the command-line client for your database, for
your example, it's called 'mysql' and might reside in /usr/local/bin/mysql,
on whatever machine you are doing this from.
Example...

I have a database on 83200.mysql.com (example) that I have a file mysql.sql
(also just an example).

The file was produced using an sqldump command from a web interface...
If you just want to run the sql:

mysql -h 83200.mysql.com -u your_username -pyour_password database_wordpr ess < mysql.sql

How can I configure a connection if I am not on 83200.mysql.com so that I
can import the data into a database with a name of database_wordpr ess


The host, username, password, and database parameters are for those
of the *DESTINATION* database. Depending on how the sqldump command
was done, it may have the database name(s) embedded in the mysql.sql
file and you might have to edit that file to change it. mysqldump
can, for example, put dumps of all tables in all databases into a
sql dump file, and it will switch databases inside the file.

Your database might be set to only allow direct database access
from specific hosts (like localhost only), "for your security". If
your database is run by a hosting company, there may be no way
around this restriction, other than putting your database on your
own server, or changing hosting companies.

Gordon L. Burditt
Sep 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3251
by: Raffi | last post by:
I use the --all-databases switch to backup my entire database. Sometimes there's a need to restore individual databases or tables form the backup file. What command should I use for this? Thanks, Raffi
4
1786
by: Raffi | last post by:
Hi, I'm developing a database application that uses numeric databases. At this point not using numeric databases is not an option. Doing a mysqldump works. However when trying to restore the database with "mysql -u root -psecret < backup.sql" gives the following error message: ERROR 1064 at line 11: You have an error in your SQL syntax near '123456789' at line 1
5
8140
by: Mike Nolan | last post by:
I have a 600K row table on my production system (running 7.3.3) that I dump and load on my development system (7.4.1) every night using cron jobs. I would like to be able to restore the table under a different table name without first having to play games with the development copy of the table. If I edit the dump file with 'sed' to change the table name, I get 'invalid command \N' errors trying to reload it.
3
2705
by: mike | last post by:
I have just upgraded froom Fedora test1 to test2 which has upgraded postgres version from 7.4.2 to 7.4.5 (frrom rpm -q) I have used pg_dumpall to dump my database, the restore appeared to go OK, except there is no data in two of my tables (only these two) output from \d \d tb_invoice_header Table "public.tb_invoice_header" Column | Type
3
7580
by: Clodoaldo Pinto Neto | last post by:
Hi all, I'm restoring a database from 7.3.4 FC1 to 7.4.2 FC2: $ pg_restore -d KakaoStats KakaoStats.dump pg_restore: could not execute query: ERROR: could not access file "$libdir/plpython": No such file or directory The dump was generated with the command:
4
4504
by: Együd Csaba | last post by:
Hi, the restoration of a dump stops at the line above. The dump was created with pgsql 7.3.2 and I need to pump it into a 7.4.3 one. Should anybody tell me what the problem can be and how I can solve it. (There are double apostophes many times in the string - is it normal??? Besides of the field separator of course...) Many thanks, Csaba Együd
2
4442
by: chenert | last post by:
Hi all, im beginner to restoring dump files and postgresql as well so hope u could bear with me.! :D i have these dump files and i've been working on restoring everything in it. i've tried this command : psql -U postgres dbname < data.dump : the tables were restored wihout any data inside it. does anyone know how I could fix this? :D
5
6566
by: Troels Arvin | last post by:
Hello, Every so often, I'm asked to help people recover data from tables that were either dropped or where to much data was DELETEed. The complications related to restoring data are a problem. The SAS users are laughing because they can (to a certain extend) easily go back to an earlier SAS table by simply starting dsm. Of course, a flat file table is different than a relational table; but still, the trouble related to restoring DB2...
1
3260
by: ntech | last post by:
Hello, i am facing a problem. I am using postgresql database in Linux. After taking the dump of any postgresql database, when i restore the dump file into a new database, i dont get any oids. so can anyone help me in this issue? Does it happen due to version mismatch? how do i take the dump so that when i restore it, the oids are also available? Thanks, Ntech
0
9568
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9399
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10007
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9957
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8832
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5276
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
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
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.