4
I have a Function (Delphi) that creates processes and executes BAT files that make, for example, backup a Mysql BD, like this:
"C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqldump.exe" -u root -proot BD > "C:\dbbackup.sql"
Is there a command line that I can create the database on the server, just the database, and then use the backup SQL and create the populated tables? Kind of:
"C:\Program Files\MySQL\MySQL Server 5.6\bin\mysql.exe" -u root -proot CREATE DATABASE BD
Then I’d use it for popular:
"C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqldump.exe" -u root -proot BD < "C:\dbbackup.sql"
The row to create the table does not work.
EDITION
I ended up discovering a code error or syntax, still working:
"C:\Program Files\MySQL\MySQL Server 5.6\bin\mysql.exe" -u root -
proot -e "CREATE DATABASE BD"
But how do I overwrite the existing database without using "IF NOT EXISTS"?
I thought in a single line, but really after searching for information it is necessary to drop before, so your simple answer is correct.
– Artur_Indio