Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restoring a MySQL DB 1

Status
Not open for further replies.

Negrazo

Programmer
Joined
Dec 28, 2006
Messages
3
Location
MX
Hi everyone:
I've just made a backup from my database, and I got a file with extension "sql"
I am using Perl on Windows XP.
The question is:
How can I restore this file using Perl???
My file is "backup20070319.sql" and contains all the Table structures and the records(rows) from each table.
Any help is welcome.
 
Just curious, why do you want to use Perl for restoring the DB. You can use mysql utility (i.e.mysqldump).



--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
You can execute the commands by simply piping the file into the mysql client program:
[tt]
mysql -u root -p12345 dbname <filename.sql
[/tt]
In a Perl program, just enclose that command in backticks to execute it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top