We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26027
    • 145 Posts
    Beginning with a phpmyadmin upgrade 2 days ago, the following statements are inserted into an export file:
    --
    -- Database: `unwantedname`
    --
    CREATE DATABASE IF NOT EXISTS `unwantedname` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
    USE `unwantedname`;


    The statements in boldface are the new ones added, while the first one has been there for a while and doesn't cause a problem.

    The boldfaced database names DO cause a problem and prevent the site from being pushed.

    The server administrator just told me they can't do anything about this, and I don't believe him.

    I have very little interest in editing the export files every day and removing the offending lines or renaming the DBs to the names of the production DB, the two proposed solutions.

    If anyone knows of a solution I would very much appreciate your posting it here.

    I've attached the ugly error I receive.

    Thanks very much ... Sam Gerber
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Are you creating the export file, or is this an automated procedure?

      When exporting, you should be given a number of options, including having/not having a create database line.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 3749
        • 24,544 Posts
        To expand on what Susan said, you can set the options and I think they tend to be sticky, so even if the process is automated, it *might* work to do a manual export once to set the options.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 26027
          • 145 Posts
          Quote from: sottwell at Jun 10, 2013, 03:59 PM
          Are you creating the export file, or is this an automated procedure?
          I create the export manually Susan. It doesn't take long.
          When exporting, you should be given a number of options, including having/not having a create database line.
          Susan, I do have Create options but never gave them much thought. I've attached a graphic which shows them to you. I'm confused by them because I will never want to create a database but I would want to create new tables if they came into existence. Is there a combination of responses to my phpmyadmin options to do what I want?
          Also, Susan, if I specify not to create a database will phpmyadmin also suppress the USE statement, as previously shown?
            • 26027
            • 145 Posts
            Quote from: BobRay at Jun 10, 2013, 05:43 PM
            To expand on what Susan said, you can set the options and I think they tend to be sticky, so even if the process is automated, it *might* work to do a manual export once to set the options.
            BobRay thanks for writing. Since I always do manual exports, that answers your comment, yes?
              • 26027
              • 145 Posts
              Quote from: samg at Jun 10, 2013, 06:56 PM

              Susan, I do have Create options but never gave them much thought. I've attached a graphic which shows them to you. I'm confused by them because I will never want to create a database but I would want to create new tables if they came into existence. Is there a combination of responses to my phpmyadmin options to do what I want?
              Also, Susan, if I specify not to create a database will phpmyadmin also suppress the USE statement, as previously shown?
              Kind of sad when you write to yourself, but this is really to Susan. I just ran a test and removed all 5 checkboxes under 'Object Creation Options'.

              phpmyadmin went ahead and seemingly ignored that and placed the same 3 bloody references to the wrong database into the export file.

              This stuff can get really frustrating.

              --- Sam
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Yes, I did some checking on the latest version, and it appears that it adds that line in the background. The only solution I saw was a hack of the code, which of course is not an option if you're using it from a shared hosting control panel.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 26027
                  • 145 Posts
                  Quote from: sottwell at Jun 10, 2013, 11:06 PM
                  Yes, I did some checking on the latest version, and it appears that it adds that line in the background. The only solution I saw was a hack of the code, which of course is not an option if you're using it from a shared hosting control panel.
                  Susan, thanks for looking into this. Maybe I'm naive but I cannot understand how phpmyadmin can arbitrarily add the name of the database to the exported file. This absolutely assumes that the export will only be used as a re-import to the same database.

                  Many, many people must be in my shoes where they have a staging database and a production database and always export from the former to import to the latter. Now, the import will throw an error (or worse just not update and without error messages). They've made it necessary for us to manually edit the exported file and either change the 3 instances of the DB name to the correct one or else remove the unnecessary statements.

                  I often wonder why I'm the only one who complains about things like this. Makes me feel like a malcontent.

                  Anyway .... thanks Susan.
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    No, you're not the only one having problems with this. I've never run across it yet, but it seems pretty stupid to me. Somebody wasn't thinking.
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 3749
                      • 24,544 Posts
                      I have to agree. Moving a site from localhost to remote or vice versa could be very ugly for some people. Hopefully, it will be patched soon.

                      OTOH, it might make MyComponent more popular. wink
                        Did I help you? Buy me a beer
                        Get my Book: MODX:The Official Guide
                        MODX info for everyone: http://bobsguides.com/modx.html
                        My MODX Extras
                        Bob's Guides is now hosted at A2 MODX Hosting