diff --git a/ChangeLog b/ChangeLog
index ff06452729..73c64ceaaf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -90,6 +90,7 @@ phpMyAdmin - ChangeLog
- issue #12362 prefs_manage.php can leave an orphaned temporary file
- issue #12619 Unable to export csv when using union select
- issue #12625 Broken Edit links in query results of JOIN query
+- issue #12634 Drop DB error in import if DB doesn't exist
4.6.4 (2016-08-16)
- issue [security] Weaknesses with cookie encryption, see PMASA-2016-29
diff --git a/libraries/plugins/export/ExportSql.php b/libraries/plugins/export/ExportSql.php
index 0fa54dfb8b..30a7870ded 100644
--- a/libraries/plugins/export/ExportSql.php
+++ b/libraries/plugins/export/ExportSql.php
@@ -237,7 +237,7 @@ class ExportSql extends ExportPlugin
if ($plugin_param['export_type'] == 'server') {
$leaf = new BoolPropertyItem(
"drop_database",
- sprintf(__('Add %s statement'), 'DROP DATABASE')
+ sprintf(__('Add %s statement'), 'DROP DATABASE IF EXISTS')
);
$subgroup->addProperty($leaf);
}
@@ -796,7 +796,7 @@ class ExportSql extends ExportPlugin
}
if (isset($GLOBALS['sql_drop_database'])) {
if (!PMA_exportOutputHandler(
- 'DROP DATABASE '
+ 'DROP DATABASE IF EXISTS '
. Util::backquoteCompat(
$db_alias,
$compat,
diff --git a/test/classes/plugin/export/ExportSqlTest.php b/test/classes/plugin/export/ExportSqlTest.php
index 87031fd71f..abcfc4e817 100644
--- a/test/classes/plugin/export/ExportSqlTest.php
+++ b/test/classes/plugin/export/ExportSqlTest.php
@@ -587,7 +587,7 @@ class ExportSqlTest extends PMATestCase
$result = ob_get_clean();
$this->assertContains(
- "DROP DATABASE `db`;\n",
+ "DROP DATABASE IF EXISTS `db`;\n",
$result
);
@@ -625,7 +625,7 @@ class ExportSqlTest extends PMATestCase
$result = ob_get_clean();
$this->assertContains(
- "DROP DATABASE db;\n",
+ "DROP DATABASE IF EXISTS db;\n",
$result
);