We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23299
    • 1,161 Posts
    I have one site that has been live for some time now.

    All of a sudden I get the following error:
    MODx encountered the following error while attempting to parse the requested resource:
    « PHP Parse Error »
     
    PHP error debug
      Error:	mysql_connect() [function.mysql-connect]: Access denied for user 'username'@'localhost' (using password: YES)	 
      Error type/ Nr.:	Warning - 2	 
      File:	/home/username/public_html/seattlecruiserheads/manager/includes/extenders/dbapi.mysql.class.inc.php	 
      Line:	87	 
      Line 87 source:	 if (!$this->conn = ($persist ? mysql_pconnect($host, $uid, $pwd) : mysql_connect($host, $uid, $pwd, true))) {	 
     
    Parser timing
      MySQL:	0.0000 s	(0 Requests)
      PHP:	0.0161 s	 
      Total:	0.0161 s	 
    Error while inserting event log into database.


    (I have substituted the generic "username" here...)

    Any ideas on what to do?

    Max

      • 23299
      • 1,161 Posts
      I went to my host cpanel and used the "Check DB" function and the report says all is well...

      If I try to go to the site/manager page I get this:

      Failed to create the database connection!

      . Please run the MODx install utility
        • 7231
        • 4,205 Posts
        I think this means that you are using an incorrect password. Check the database user settings (username/password) if they are correct then your host may have changed something on the host without warning you.
          [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

          Something is happening here, but you don't know what it is.
          Do you, Mr. Jones? - [bob dylan]
          • 23299
          • 1,161 Posts
          I have not changed any database settings recently...

          I did add the friendly URLs which included the php.ini file changes etc. But the site was working just fine...


            • 33372
            • 1,611 Posts
            You probably messed up something in your php.ini file, so check that first.
              "Things are not what they appear to be; nor are they otherwise." - Buddha

              "Well, gee, Buddha - that wasn't very helpful..." - ZAP

              Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
              • 26903
              • 1,336 Posts
              Error: mysql_connect() [function.mysql-connect]: Access denied for user ’username’@’localhost’ (using password: YES)
              This is coming from MYSQL, your username and/or host,password are no longer allowed to be used with your chosen DB. Try and login to MYSQL using the CLI or some other tool, if you can check your config.inc.php file for any differences.
                Use MODx, or the cat gets it!
                • 23299
                • 1,161 Posts
                Thanks,

                I was on "Chat" with the host tech support for quite some time last night: in the end the guy had to have some other guy look into later on. This morning I received an email saying they had "fixed" the problem. The site is up again which is the main thing. I did reply asking for some details as I would like to know what they did.

                I did not change any of the database settings. The only change I made to the php.ini file was to fix the register_globals setting.

                Hopefully I will hear back...

                Max
                  • 20413
                  • 2,877 Posts
                  I’ve had similiar MODx error for my sites in couple of hours and at the same time
                  wasn’t allowed to login on phpMyAdmin:

                  #1040 - Too many connections

                  and for MODx:

                  PHP error debug
                    Error:  mysql_connect() [function.mysql-connect]: Too many connections  
                    Error type/ Nr.:  Warning - 2


                  If I remember it correct I first had a parsing error looking like yours before it
                  switched to this.

                  My host fixed this and apologized for not better monitoring the system!?  
                    @hawproductions | http://mrhaw.com/

                    Infograph: MODX Advanced Install in 7 steps:
                    http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                    Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                    http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
                    • 33372
                    • 1,611 Posts
                    Usually you need to include all of your PHP settings in your local php.ini files, not just the ones that you are overriding. So if there was an environment variable in there that determined something like where PHP would find your database server and it was not set in your local php.ini file you could break all connections. The other issues is that you may need to upload a php.ini file to every subdirectory on your site if you can’t get the settings to change globally with just one in the root.

                    I usually ask the host to set register_globals to off for me rather than mess with local php.ini files because they can be such a nuisance.
                      "Things are not what they appear to be; nor are they otherwise." - Buddha

                      "Well, gee, Buddha - that wasn't very helpful..." - ZAP

                      Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
                      • 23299
                      • 1,161 Posts
                      To conclude this issue I thought you all might like to hear this.

                      I received the following from the host tech support...
                      Unfortunately the problem was the length of the MySQL username
                      as the recent upgrade we have done on our servers to upgrade them from MySQL 5.0 to
                      5.1 resulted in the truncation of MySQL usernames to a maximum of 16 characters. We
                      just had to simply create a new MySQL user with a shorter username and correct your
                      MySQL connection information. You can however read more about the issue on our forum
                      post at http://forums.hostgator.com/isolated-mysql-database-issues-t47203.html

                      We apologize for any inconvenience and if you need further assistance please let us
                      know.