0

I have full log of all databases and tables from mysql from my old server. it takes 800mb. (i run mysqldump to dump all data) i want to restore into new server only 2 databases, each having several tables;

i need an advice how could i process this fils with minimal effort to put only say "database1" and "database2" into my new server mysql.

i was thinking about importing all of them and then dropping unnecessary, but this way i'll override "mysql" system database, which i don't want to.

i'm on debian linux and i can't even edit this 800mb file as its too large.

and as it is server , i have only ssh access to it. no GUI.

thanks in advance

Demo_S
  • 789
  • 5
  • 7

2 Answers2

1

Assuming that your dump contains 10 databases then couldn't you run:

mysql -u username -p database_name_1 < file.sql
mysql -u username -p database_name_2 < file.sql

This would then import just database_name_1 and database_name_2

Chris
  • 4,672
  • 13
  • 52
  • 93
  • well, this will import _ALL_ data from my database_dump.sql file. but i need to import only 2 of them, not all. and besides this, as i mentioned, this will overwrite "mysql" database, which i don't want to overwrite. i could do this if i can filter out "mysql" db – Demo_S Mar 18 '17 at 06:09
  • 1
    I've edited my answer. Wouldn't this do the job? Maybe I've misunderstood? – Chris Mar 18 '17 at 13:25
0

well, i used this advice Split one file into multiple files based on delimiter to split my file into multiple files, one per database, using "Dumping routines for database" as delimiter. and after some cleaning and renaming i got 1 sql file per database so i'm able to import my two databases separately.

Community
  • 1
  • 1
Demo_S
  • 789
  • 5
  • 7