{"id":13461094,"date":"2020-09-28T01:10:53","date_gmt":"2020-09-28T01:10:53","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/error-unable-to-remove-table-from-database-mydb-create_synonym_db\/"},"modified":"2020-09-28T01:52:43","modified_gmt":"2020-09-28T01:52:43","slug":"error-unable-to-remove-table-from-database-mydb-create_synonym_db","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/error-unable-to-remove-table-from-database-mydb-create_synonym_db\/","title":{"rendered":"Error: Unable to remove table from database &#8220;mydb.create_synonym_db&#8221;."},"content":{"rendered":"<p>Hello,<\/p>\n<p>When installing a package, during the install database step, I got this error:<\/p>\n<pre><code>INSTALL ERROR!\nDATABASE CREATION FAILURE!\nUnable to remove table from database &quot;mydb.create_synonym_db&quot;.\nPlease remove all tables from this database and try the installation again. If no tables show in the database, then Drop the database and re-create it.\nERROR MESSAGE:<\/code><\/pre>\n<p>(the error message is empty)<\/p>\n<p>The database was freshly created, has no table, no view, no stored procedure. I&#8217;ve recreated it a couple of times to be sure, it doesn&#8217;t help.<\/p>\n<p>There are a few people complaining on this but I could not find any helpful things, for example: https:\/\/wordpress.org\/support\/topic\/not-able-to-install-backup-after-step-2\/<\/p>\n<p>So I&#8217;ve looked at the installer php files, and found this function in &#8220;dup-installer\/ctrls\/ctrl.s2.dbinstall.php&#8221;:<\/p>\n<pre><code>\nprivate function dropProcs()\n{\n    $sql    = &quot;SHOW PROCEDURE STATUS&quot;;\n    $found  = array();\n    if ($result = mysqli_query($this-&gt;dbh, $sql)) {\n        while ($row = mysqli_fetch_row($result)) {\n            $found[] = $row[1];\n        }\n        if (count($found) &gt; 0) {\n            foreach ($found as $proc_name) {\n                $sql    = &quot;DROP PROCEDURE IF EXISTS &lt;code&gt;&amp;quot;.mysqli_real_escape_string($this-&gt;dbh, $this-&gt;post[&#039;dbname&#039;]).&amp;quot;&lt;\/code&gt;.&lt;code&gt;&amp;quot;.mysqli_real_escape_string($this-&gt;dbh, $proc_name).&amp;quot;&lt;\/code&gt;&quot;;\n                if (!$result = mysqli_query($this-&gt;dbh, $sql)) {\n                    DUPX_Log::error(sprintf(ERR_DBTRYCLEAN, &quot;{$this-&gt;post[&#039;dbname&#039;]}.{$proc_name}&quot;).&quot;&lt;br\/&gt;ERROR MESSAGE:{$err}&quot;);\n                }\n            }\n        }\n    }\n}\n<\/code><\/pre>\n<p>It seems that it tries to drop ALL the procedures from ALL the databases (&#8220;SHOW PROCEDURE STATUS&#8221; lists all the procedures for ALL databases).<\/p>\n<p>The &#8220;create_synonym_db&#8221; procedure is there by default on my MySQL installation, and is present in the &#8220;sys&#8221; database, so this seems to incorrectly try to drop it.<\/p>\n<p>If I edit the file and change the SQL with &#8220;&#8221;SHOW PROCEDURE STATUS <strong>WHERE db = &#8216;mydb&#8217;<\/strong>&#8221; then it works.<\/p>\n<p>The error message is very confusing, as it says it is unable to drop a table (where in fact this is a procedure, and from a different database).<\/p>\n<p>Can this please be fixed?<\/p>\n","protected":false},"template":"","class_list":["post-13461094","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/13461094","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":3,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/13461094\/revisions"}],"predecessor-version":[{"id":13461124,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/13461094\/revisions\/13461124"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=13461094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}