Database errors, site won't load

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zoom6
    New Member
    • Jan 2013
    • 3
    • 3.8.x

    Database errors, site won't load

    Good evening everyone. Let me start by saying I am nowhere near a pro here. I'm learning what I need as I go (for the most part), but I'm pretty stuck right now. I'm also sorry ahead of time for the length of this post, I just want to do my best to include all necessary information and all steps I've taken thus far.


    This morning we noticed a flood (thousands) of error emails coming in. Most of the emails were for the use of mysql vs mysqli (see below). Our forum was down also.

    -Database error in vBulletin :
    -
    -mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead /home4/nemotors/public_html/boards/includes/class_core.php on -line 311
    -
    -MySQL Error :
    -Error Number :
    -Request Date : Wednesday, January 13th 2016 @ 09:11:42 AM
    -Error Date : Wednesday, January 13th 2016 @ 09:11:42 AM
    -Script : http://nemotorsport.com/
    -Referrer :
    -IP Address : 93.92.217.228
    -Username :
    -Classname : vB_Database
    -MySQL Version :
    -

    Line 311 read as follows... (i attached the file also for review)

    PHP Code:
              $link $this->functions[$usepconnect 'pconnect' 'connect']("$servername:$port"$username$password); 

    After some research, I found that we needed to change the "mysql" functions to "mysqli". I changed them in the class_core.php file, and also changed "mysql_pconnect" to mysqli_connect", as it seems persistent connections aren't supported in mysqli (at least according to what I read today. Again, I'm no expert here.).

    I uploaded the file, and got a new error email (see below).

    -Database error in vBulletin :
    -
    -mysqli_connect(): (HY000/2005): Unknown MySQL server host 'localhost:3306' (0) /home4/nemotors/public_html/boards/includes/class_core.php on line 311
    -
    -MySQL Error :
    -Error Number :
    -Request Date : Wednesday, January 13th 2016 @ 09:13:02 PM
    -Error Date : Wednesday, January 13th 2016 @ 09:13:02 PM
    -Script : http://nemotorsport.com/
    -Referrer :
    -IP Address : 98.229.237.162
    -Username :
    -Classname : vB_Database
    -MySQL Version :
    -
    More research told me that I can't have 'Server:Port', so I edited line 311 as follows...

    PHP Code:
                $link $this->functions[$usepconnect 'pconnect' 'connect']($servername$port$username$password); 
    And I got another error email...

    -Database error in vBulletin :
    -
    -mysqli_connect(): (28000/1045): Access denied for user '3306'@'localhost' (using password: YES) /home4/nemotors/public_html/boards/includes/class_core.php on line 311
    -
    -MySQL Error :
    -Error Number :
    -Request Date : Wednesday, January 13th 2016 @ 09:20:35 PM
    -Error Date : Wednesday, January 13th 2016 @ 09:20:35 PM
    -Script : http://nemotorsport.com/
    -Referrer :
    -IP Address : 98.229.237.162
    -Username :
    -Classname : vB_Database
    -MySQL Version :
    -
    MORE research showed me that the order of "$servername, $port, $username, $password" was incorrect. So I edited line 311 again as follows...

    PHP Code:
                $link $this->functions[$usepconnect 'pconnect' 'connect']($servername$username$password$port); 
    You guessed it, another error...

    -Database error in vBulletin :
    -
    -mysqli_connect(): (42000/1044): Access denied for user 'nemotors_nem'@'localhost' to database '3306'
    -/home4/nemotors/public_html/boards/includes/class_core.php on line 311
    -
    -MySQL Error :
    -Error Number :
    -Request Date : Wednesday, January 13th 2016 @ 09:23:26 PM
    -Error Date : Wednesday, January 13th 2016 @ 09:23:26 PM
    -Script : http://nemotorsport.com/
    -Referrer :
    -IP Address : 98.229.237.162
    -Username :
    -Classname : vB_Database
    -MySQL Version :
    -
    So I figured it was looking for $database before $port. I edited it again to this...

    PHP Code:
                $link $this->functions[$usepconnect 'pconnect' 'connect']($servername$username$password$database$port); 
    Another error...

    -Database error in vBulletin :
    -
    -Undefined variable: database
    -/home4/nemotors/public_html/boards/includes/class_core.php on line 311
    -
    -MySQL Error :
    -Error Number :
    -Request Date : Wednesday, January 13th 2016 @ 09:26:34 PM
    -Error Date : Wednesday, January 13th 2016 @ 09:26:34 PM
    -Script : http://nemotorsport.com/
    -Referrer :
    -IP Address : 98.229.237.162
    -Username :
    -Classname : vB_Database
    -MySQL Version :
    -
    I won't lie, I don't know how to define a variable, so I just tried line 311 like this...

    PHP Code:
                $link $this->functions[$usepconnect 'pconnect' 'connect']($servername$username$password); 


    Since the last edit, I'm not seeing any line-specific errors. Instead the forum is still down and I get this error email...

    -Database error in vBulletin :
    -
    -Cannot use database nemotors_boardedup
    -
    -MySQL Error :
    -Error Number : 0
    -Request Date : Wednesday, January 13th 2016 @ 09:29:18 PM
    -Error Date : Wednesday, January 13th 2016 @ 09:29:18 PM
    -Script : http://nemotorsport.com/
    -Referrer :
    -IP Address : 98.229.237.162
    -Username :
    -Classname : vB_Database
    -MySQL Version :
    -
    I'm really not sure where to go from here. Any help would be greatly appreciated!

  • motd2
    Member
    • Jun 2010
    • 49
    • 3.8.x

    #2
    includes/config.php
    Find:
    $config['Database']['dbtype'] = 'mysql';
    Replace:
    $config['Database']['dbtype'] = 'mysqli';


    class_core.php no need to change

    Comment

    • zoom6
      New Member
      • Jan 2013
      • 3
      • 3.8.x

      #3
      Originally posted by motd2
      includes/config.php
      Find:
      $config['Database']['dbtype'] = 'mysql';
      Replace:
      $config['Database']['dbtype'] = 'mysqli';


      class_core.php no need to change

      You my friend, are my hero today! Thank you, that fixed it!

      Comment

      • Paul M
        Former Lead Developer
        vB.Com & vB.Org
        • Sep 2004
        • 9886

        #4
        Obviously your host upgraded you to php 5.5 (or 5.6) - did they bother to mention that to you ?

        You dont need to edit any core files, just set the type to 'mysqli' as above.

        JFYI, vB3 and vB4 do this silently without you having to manually do it, so sites dont just go down, they decided not to do this in vB5.

        Baby, I was born this way

        Comment

        • zoom6
          New Member
          • Jan 2013
          • 3
          • 3.8.x

          #5
          Originally posted by Paul M
          Obviously your host upgraded you to php 5.5 (or 5.6) - did they bother to mention that to you ?

          You dont need to edit any core files, just set the type to 'mysqli' as above.

          JFYI, vB3 and vB4 do this silently without you having to manually do it, so sites dont just go down, they decided not to do this in vB5.

          I'm not the primary Admin on this site, I just help out here and there. I don't get the hosting emails. They may have informed him, but I'm not 100% sure.

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...