Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-22127

MariaDB 10.4 can't import database dump created before 10.4

    XMLWordPrintable

    Details

      Description

      MariaDB 10.4 can't import a database dump that was created by MariaDB < 10.4 and reports message: "ERROR 1050 (42S01) at line 804: Table 'user' already exists"

      The problem seems to be caused by changes in MariaDB 10.4 where mysql.global_priv table has replaced the mysql.user table, and mysql.user is now a view. So when you create a dump of the DB in 10.4, it drops both table and view before "CREATE TABLE `user`":

      MariaDB 10.4 dump

      --
      -- Temporary table structure for view `user`
      --
       
      DROP TABLE IF EXISTS `user`;
      /*!50001 DROP VIEW IF EXISTS `user`*/;
      SET @saved_cs_client     = @@character_set_client;
      SET character_set_client = utf8;
      /*!50001 CREATE TABLE `user` (
      ...
      

      But when you create a dump e.g. on MariaDB 10.2 (tested with 10.2.31), only a table is dropped:

      MariaDB 10.2 dump:

      --
      -- Table structure for table `user`
      --
       
      DROP TABLE IF EXISTS `user`;
      /*!40101 SET @saved_cs_client     = @@character_set_client */;
      /*!40101 SET character_set_client = utf8 */;
      CREATE TABLE `user` (
      

      When a user wants to restore 10.2 dump with MariaDB 10.4, the view is not dropped and MariaDB reports "Table 'user' already exists" error. If the "DROP VIEW IF EXISTS" statement is added to the dump, then it's restored without any problems.

        Attachments

          Activity

            People

            Assignee:
            sanja Oleksandr Byelkin
            Reporter:
            kstreitova Kristyna Streitova
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: