MySQL Database Connection error

Started by DarkLord7854, November 15, 2005, 03:31:35 PM

Previous topic - Next topic

DarkLord7854

Hi,
I didn't know where to post this in so I thought might as well put it here. My host moved me to another server, so the IP changed. I backed up everysingle files and databse and everything on my server and trasnferred everything back the exact same way it was. All folders and databses have been restored to EXACTLY how they were. However, now the SMF boards give me an error about not being able to connect to the database. I checked the database and it's there. I asked a few of my friends and they told me I should look in Index or Settings.php and make sure the right databse settings are there. I know what the host and username are but I have no clue what the password is. My server control panel has a page where it tells me the PHP coding needed to connect to the database and for password it's listed <PASSWORD HERE>
I'm not experienced at all in MySQL, so I would really appreaciate some help  ;)

Oldiesmann

If you don't know what the password is for that MySQL user account, delete it and re-create it with the password that's listed in Settings.php

Based on your description of the control panel, it sounds like you've got cPanel (a very popular system among webhosts...), so here's what you need to do:

Login to cPanel and click on "MySQL Databases"
First, remove that member account from the database by clicking "Delete" next to the username under the section that says "Users in yourdatabase" (yourdatabase = the name of your database).
Then, delete the actual user account by clicking on "Delete" next to the username in the "Users" section

Finally, re-create that account and add it to the database again:
Enter the username and password in the appropriate boxes (the username should NOT have the prefix on it as that's added automatically by cpanel) and click on "Add User"
Right above that, you should see a couple of dropdown lists and "Priveleges:" followed by a bunch of checkboxes.
Select the newly created user from the first list and the database from the second list.
Make sure that the box next to "All" is checked (it should be checked by default, but double-check anyway) and click on "Add User to Db"
Michael Eshom
Christian Metal Fans

DarkLord7854

Well I tried that and it's still saying that it can't connect to the database  :'(

Oldiesmann

Try this:

index.php

Find
// Show an error if the connection couldn't be made.
if (!$db_connection || !@mysql_select_db($db_name, $db_connection))
db_fatal_error();


Replace
// Show an error if the connection couldn't be made.
if (!$db_connection || !@mysql_select_db($db_name, $db_connection))
die(mysql_error());
Michael Eshom
Christian Metal Fans

DarkLord7854

#4
Well I made progress, by replacing that line I moved away from the database connection error. Now it's showing this:

QuoteNotice: Only variables should be assigned by reference in /home/darklord/public_html/batmod/Sources/Subs.php on line 232

Notice: Only variables should be assigned by reference in /home/darklord/public_html/batmod/Sources/Subs.php on line 232

Notice: Only variables should be assigned by reference in /home/darklord/public_html/batmod/Sources/Subs.php on line 232

Notice: Only variables should be assigned by reference in /home/darklord/public_html/batmod/Sources/Subs.php on line 232

Notice: Undefined index: is_admin in /home/darklord/public_html/batmod/Sources/Security.php on line 556

Notice: Undefined index: permissions in /home/darklord/public_html/batmod/Sources/Security.php on line 563

Warning: in_array(): Wrong datatype for second argument in /home/darklord/public_html/batmod/Sources/Security.php on line 563
session_start(): Cannot send session cookie - headers already sent by (output started at /home/darklord/public_html/batmod/Sources/Subs.php:232)

In the Subs.php on line 232 is:
Quote$ret = &mysql_query($db_string, $db_connection);

In the Security.php on line 556 is:
Quoteif ($user_info['is_admin'])

Line 563:
Quoteif (!is_array($permission) && in_array($permission, $user_info['permissions']))

Oldiesmann

Michael Eshom
Christian Metal Fans

DarkLord7854

Ok well that fixed the errors, now I get a new one:

Quote
Fatal error: Call to undefined function: autowarn() in /home/darklord/public_html/batmod/index.php on line 151

Oldiesmann

That function was most likely in Subs.php, so you'll have to find that mod and put the function back in Subs.php
Michael Eshom
Christian Metal Fans

DarkLord7854


DarkLord7854

I can't find the autowarn() function anywhere in Subs.php

redone

That is what Oldiesmann said. You have a mod installed that uses a modification in your subs file. You need to locate the mod and put back the required edit within subs.php for the mod to work together with your subs file.

~redone


DarkLord7854

Err... How do I locate the mod? Could I just take it out of the Index.php file and that way not have to put it into Subs.php?

redone

A quick solution would be just to upload clean sources and theme files. You will also need to clean out your /Packages/installed.list file too. And yes that includes a clean copy of index.php.




DarkLord7854

But all the posts and user data is stored in the MySQL database right?

JayBachatero

Yes all the data is stored in the database.  Download the upgrade package and run upgrade.php
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Advertisement: