I have a file created with mysqldump that is 11GB. I need to use the "mysql" command to import it into a database, but I need to add:
USE db1;
at the top. It would take forever to rewrite the file. Is there a way I can concatenate another file at the beginning of the input redirect to fool it into looking at it as a single file?
text.txt contents:
USE db1;
sql_out.sql contents:
data from mysqldump using the --skip-add-drop-table and --no-create-info options
command attempted:
mysql --host=<host> --user=<user> --password=<pwd> < echo $(cat text.txt sql_out.sql)
When I do that I get:
echo: No such file or directory
If I try it without the echo, I get:
$(cat text.txt sql_out.sql): ambiguous redirect
Is there a way to do this?
-D db1
option to mysql, and redirect the contents of the sql file to the mysql command without even usingcat
. Ex:mysql -host foo.io -u -p1234 yoda -D db1 < sql_out.sql