Create database via command line and overwrite existing

Posted on

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.


I ended up discovering a code or syntax error, keep working:

"C:Program FilesMySQLMySQL Server 5.6binmysql.exe" -u root -

But how do I overwrite the existing bank without using “IF NOT EXISTS”?


Answer :

Deleta Database

Create Database

Drop Database BD
Create Database BD


Leave a Reply

Your email address will not be published. Required fields are marked *