Question :
I have a function (Delphi) that creates processes and executes BAT files that do, for example, backup of a MySQL BD, like this:
"C:Program FilesMySQLMySQL Server 5.6binmysqldump.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?
"C:Program FilesMySQLMySQL Server 5.6binmysql.exe" -u root -proot CREATE DATABASE BD
Then I would use this for popular:
"C:Program FilesMySQLMySQL Server 5.6binmysqldump.exe" -u root -proot BD < "C:dbbackup.sql"
The line to create the table does not work.
EDITION
I ended up discovering a code or syntax error, keep working:
"C:Program FilesMySQLMySQL Server 5.6binmysql.exe" -u root -
proot -e "CREATE DATABASE BD"
But how do I overwrite the existing bank without using “IF NOT EXISTS”?
Answer :
Deleta Database
Create Database
Drop Database BD
Create Database BD