I want to include all tables from a database \"shop\" to mydatabase newshop
. I export that \"shop\" database, and now it is named as shop.sql
. Is t
I think what you need might be:
$ mysql -u $USERNAME -p < "$SQLFILENAME"
Where $USERNAME is the user name of mysql like root
and $SQLFILENAME is the name of the sql file ('shop.sql
' in this case).
The above command will ask you to type in password. If you don't want to do that every time, you can use '--password=$PASSWORD' BUT be careful. This password may be saved in history and it might be in the wrong hand (If you run it from PHP, it may not be a problem).
OR you can use mysqli to run it.
Hope this helps.