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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

restoring multiple databases

Status
Not open for further replies.

formasfunction

Technical User
Jul 6, 2004
7
US
So I used phpMyAdmin to export about 6 databases into on .sql file. All of the tutorials I've read about restoring databases talk about restoring into a current db. If I have 6 dbs in the file, what is the correct restoration command? I'm working the restore on the command line, not phpMyAdmin. I know this command:
mysql -u [username] -p [password] [database_to_restore] < [backupfile]
but obviosly I there isn't just one "database to restore" in my .sql file, there are 6. Any help would be greatlly appreciated.

Thanks,
Greg
 
mysql -u root -p

enter the password when prompted

mysql> \. /path/to/file.sql

and watch it go.

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Thanks a bunch! One more quick question, what is the path that mysql takes? When I'm in "mysql>" is the path from the location of mysql or from the root? I running RedHat Linux so the path to mysql is /usr/bin/mysql. If I put the file in /usr/bin/file.sql does that mean I write the code as follows:

mysql> \. file.sql

OR

mysql> \. /usr/bin/file.sql

Thanks in advance.

--Greg
 
fully qualified path of the file :
/usr/bin/file.sql

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
oh, sidenote 3 .. engage brain .. you may well need to enclose file and path in single quotes:

'/usr/bin/file.sql'

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top