Need quick answer - How to run file with sql commands?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Starcraftmazter
Forum Commoner
Posts: 45
Joined: Mon Apr 24, 2006 11:36 pm

Need quick answer - How to run file with sql commands?

Post by Starcraftmazter »

Hey.

I have a database I need to restore. It was generated via a cPanel backup. cPanel fails to restore it, phpmyadmin fails to restore the table phpbb_search_wordmatch (yes, phpbb2), because it's so big and fat. I even tried to split that one table's data into 8 seprate files around 500k and import them separately, it still stuffs up half of them, sometimes giving max execution error, even though i've set it to 6000 seconds, sometimes it just prompts me to download the .php file of phpmyadmin after a long while.


Long story short, I've decided to upload the file with the data of that table to the server, and make mysql import it via the shell.

Only trouble is, I don't know what command to use. I read up something on using batch files with mysql, and I didn't quite get it, which is why my attempts failed.


I have root access to the server & mysql, so thats not a problem.


Thanks.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

Code: Select all

source path/to/your/sql/file.sql;
Starcraftmazter
Forum Commoner
Posts: 45
Joined: Mon Apr 24, 2006 11:36 pm

Post by Starcraftmazter »

I love you.

I spent hours and hours trying to restore this crappy thing, and now I just saw it happen in 2 seconds 8O
Post Reply