Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: tyqre on January 19, 2011, 06:25:21 PM

Title: Cannot Connect to Database.
Post by: tyqre on January 19, 2011, 06:25:21 PM
I have moved my forums directory to another computer but all the links etc. stayed the same.  Is there any way to fix this? It went from C:/xampp/xampp/htdocs/comm to D:/xampp/htdocs/comm . Everything should still work as far as im concerned. phpMyAdmin still works (i can log in atleast) and MySql is running.
There is a database called cdcol , infromation_schema, mysql and phpmyadmin. Are any of these part of my forum?
Title: Re: Cannot Connect to Database.
Post by: Illori on January 19, 2011, 07:18:36 PM
What is repair_settings.php? (http://docs.simplemachines.org/index.php?topic=663.0) should help you fix that.
Title: Re: Cannot Connect to Database.
Post by: tyqre on January 19, 2011, 07:45:32 PM
i just went back to the backup to start fresh, i backed the database and i am now ready to migrate to new server. What do i need to do to get it back to normal (i was using a theme).
Do i install a new SMF and add the theme and the database ?
Title: Re: Cannot Connect to Database.
Post by: Tyrsson on January 19, 2011, 07:55:04 PM
Move your files to the root of the webspace and then load the repair settings file in a browser to reset the file paths. Once that is done login and go to admin=>themes and layout->attempt to reset all themes. The repair settings tool only repairs the default themes file paths.
Title: Re: Cannot Connect to Database.
Post by: tyqre on January 19, 2011, 08:01:38 PM
Quote from: Tyrsson™ on January 19, 2011, 07:55:04 PM
Move your files to the root of the webspace and then load the repair settings file in a browser to reset the file paths. Once that is done login and go to admin=>themes and layout->attempt to reset all themes. The repair settings tool only repairs the default themes file paths.
So is this with my original set up? Just copy and paste my old directory to the new one and do as you said?

I dont see a "repairsettings.php" or anything with repair and settings in the same file name.

Another question would be - "How do I add the database i backed up to phpmyadmin?"
Title: Re: Cannot Connect to Database.
Post by: Tyrsson on January 19, 2011, 08:12:23 PM
One more thing.

If you look in the top level of the smf files and open Settings.php in a text editor that supports php and look for the value for $db_name that should be the value in phpmyadmin.

Doesnt matter which setup. Place them in the folder the server serves files from. The Doc root.
Title: Re: Cannot Connect to Database.
Post by: tyqre on January 19, 2011, 08:25:22 PM
Ok, so i have everything in place except for one thing. The reason why it wont work ( i believe ) is because the database is not present. I do not know how to add the mysql database back with phpmyadmin. When ever i try to add the database back i get an error. I have tried two times.

It keeps giving me the error "No database selected".


I got the mysql database in phpymadmin successfully now. But i still get "Sorry,SMF was unable to connect to the database. This may be caused by the server being busy. Please try again later."
Title: Re: Cannot Connect to Database.
Post by: Illori on January 19, 2011, 08:27:22 PM
have you run the repair_settings.php file?
Title: Re: Cannot Connect to Database.
Post by: tyqre on January 19, 2011, 08:31:04 PM
Quote from: Illori on January 19, 2011, 08:27:22 PM
have you run the repair_settings.php file?
If its in the root of smf install, i cant find it.
Title: Re: Cannot Connect to Database.
Post by: tyqre on January 19, 2011, 08:35:57 PM
GOT IT TO WORK! Thaks for all your replys. Turns out that i had no password for phpmyadmin this time. Thanks. Dont mark solved though, not yet because i still have some errors on my page.
Now it says that my page's template is wrong and click here to fix it. I click and it just loads for ever with the "Login" header.
Title: Re: Cannot Connect to Database.
Post by: Tyrsson on January 19, 2011, 11:27:44 PM
add this to the url right after the ?

theme=1 so it becomes:

http://www.testdomain.com/index.php?theme=1

This should load the default theme and allow you to login so that you can reset the custom themes filepaths.
Title: Re: Cannot Connect to Database.
Post by: tyqre on January 20, 2011, 05:39:08 PM
it doesn't load the error anymore but it just keeps on loading forever.
Is there any way to do this manually without going to the website? It only works if i load it with my phone but when i try to log in with the default theme it just loads forver too. Do you think this could be my server? it only has  a 1.66Ghz processor and 2GB of ram. The server isn't struggling to keep up with anything ( only about 20% of processor is being used)
Title: Re: Cannot Connect to Database.
Post by: Illori on January 20, 2011, 08:03:34 PM
can you provide a link to your forum?
Title: Re: Cannot Connect to Database.
Post by: tyqre on January 20, 2011, 09:20:27 PM
Quote from: Illori on January 20, 2011, 08:03:34 PM
can you provide a link to your forum?
http://xxfsu.com (http://xxfsu.com) <-- its a Call of Duty: Black ops clan forum
Title: Re: Cannot Connect to Database.
Post by: Illori on January 20, 2011, 09:30:47 PM
should that be redirecting to http://gigabyte.ftpaccess.cc/comm/ ?
Title: Re: Cannot Connect to Database.
Post by: Joker™ on January 21, 2011, 03:06:31 AM
Try resetting the paths using repair_settings.php as told by Illori earlier also, after that go to

Administration Center » Themes and Layout » Theme Settings >> Reset Theme URLs and Directories (use this option)
Title: Re: Cannot Connect to Database.
Post by: tyqre on January 21, 2011, 08:34:31 AM
Quote from: Illori on January 20, 2011, 09:30:47 PM
should that be redirecting to http://gigabyte.ftpaccess.cc/comm/ ?
yea
Title: Re: Cannot Connect to Database.
Post by: tyqre on January 21, 2011, 08:35:51 AM
Quote from: Joker™ on January 21, 2011, 03:06:31 AM
Try resetting the paths using repair_settings.php as told by Illori earlier also, after that go to

Administration Center » Themes and Layout » Theme Settings >> Reset Theme URLs and Directories (use this option)
I do not have repair_settings.php in my smf  forums directory. Also, my web browser will not load the forum anymore but if i go on the forum with my iphone it will load but it takes 30 seconds to load each page.

Interesting= it some what works now, it keeps telling me my default directory is wrong but I am sure that it is right.
Title: Re: Cannot Connect to Database.
Post by: Joker™ on January 21, 2011, 08:48:41 AM
Download repair_settings.php from here >> http://download.simplemachines.org/index.php?thanks;filename=repair_settings.php

upload it to your root directory and run it. Set the paths as shown by that file.

After that open your forum after that go to

Administration Center » Themes and Layout » Theme Settings >> Reset Theme URLs and Directories (use this option)
Title: Re: Cannot Connect to Database.
Post by: Illori on January 21, 2011, 08:55:22 AM
i tried for over 30 minutes to connect to your site, it did not even load that it can not connect to the database. are you hosting this forum on someone's personal computer connected to a free domain redirect service then directing to your purchased domain?
Title: Re: Cannot Connect to Database.
Post by: tyqre on January 21, 2011, 09:20:40 AM
Quote from: Illori on January 21, 2011, 08:55:22 AM
i tried for over 30 minutes to connect to your site, it did not even load that it can not connect to the database. are you hosting this forum on someone's personal computer connected to a free domain redirect service then directing to your purchased domain?
Im running it on my apache server. My ip is constantly changing so i have it hook up to a dns name that gets updated with my ip. its always been that way. Its always worked. I will download the reset_settings.php and see what happens. THanks for your help.
Title: Re: Cannot Connect to Database.
Post by: tyqre on January 21, 2011, 09:30:18 AM
It works now! Thank you all for your help. I had to all of the directorys where broken, as you said they were. Thanks again.
Title: Re: Cannot Connect to Database.
Post by: tyqre on January 21, 2011, 09:38:33 AM
Quote from: tyqre on January 21, 2011, 09:30:18 AM
It works now! Thank you all for your help. I had to all of the directorys where broken, as you said they were. Thanks again.
aND....... its not working again. It worked for like...a minutes now its slow again. I am sure all all the links are correct!

No errors but its extreemly slow.
Title: Re: Cannot Connect to Database.
Post by: Illori on January 21, 2011, 09:49:25 AM
is it slow internally or is it slow for someone connecting outside your network? it could be a problem with your router
Title: Re: Cannot Connect to Database.
Post by: tesser on January 21, 2011, 09:58:52 AM
Might not be related by here goes anyway

I use xampp if i allow it on my firewall then all connections inside and out side on my network are real slow

Now if i turn off my firewall on the server pc  i get lighting speeds inside and out side of my server  also leaving the firewall ON within my routor

server machine is running windows 7

might be worth playing with your firewall ?????????
Title: Re: Cannot Connect to Database.
Post by: tyqre on January 21, 2011, 12:35:10 PM
Quote from: tesser on January 21, 2011, 09:58:52 AM
Might not be related by here goes anyway

I use xampp if i allow it on my firewall then all connections inside and out side on my network are real slow

Now if i turn off my firewall on the server pc  i get lighting speeds inside and out side of my server  also leaving the firewall ON within my routor

server machine is running windows 7

might be worth playing with your firewall ?????????
its strange. I turned off my firewall, reset apache, tried to log on and it was pretty fast for a few seconds. I logged in with ease. THen i clicked on a topic and it just kept loading. I clicked the back button and still kept on loading.(does that everytime i reset apache)
As for if its slow outside my network.. yes it is. I am using windows home server ( i made sure the extra features on home server use port 8080 instead of 80) and i portforwarded 80 to my server (and 8080).
Title: Re: Cannot Connect to Database.
Post by: tyqre on January 22, 2011, 01:40:29 PM
bump
Title: Re: Cannot Connect to Database.
Post by: Illori on January 22, 2011, 01:43:23 PM
at this point i think you may get a better response if you post in the server configuration board since this does not seem to be an issue with smf any longer.
Title: Re: Cannot Connect to Database.
Post by: tyqre on January 22, 2011, 01:52:45 PM
ok i made a post in that board. Here is link to it if you want to look at it . http://www.simplemachines.org/community/index.php?topic=418524.0
Title: Re: Cannot Connect to Database.
Post by: Tyrsson on January 23, 2011, 12:17:01 PM
The issue is a complex one, which is why smf does not provide support for servers. The options are endless and we have no way of knowing your exact config and build options, not to even mention the complex problem of making sure that no firewall is causing problems.

Can you ping the device inside the LAN?

Do you have a static LAN IP assigned to the device on which apache is running?

My suggestions would be to set a static IP (must have for doing this type thing), also verify with your ISP that you have a static public IP. Verify that your ISP does not block port 80 (many do for this very reason). Many times I have seen them setup the NAT device (your router or modem) to run its http server instance on port 80, yep you guessed it, that kills apache from serving on port 80 for the public IP (if memory serves).

Options:

If port 80 is blocked and that is the reason many times you can change the port for which the NAT device serves. However you should NOT try this unless you know exactly what you are doing in regards to the device you are using.

Verify your dns records are pointing to the correct IP. If you do not have a static public IP then you will need to use some type of service that will report any change of IP to the record such as DynDNS or similar as the record MUST report the current IP of the device on which apache is running if it is to serve to the Web or your wide area network (if memory serves).

Due to the reasons I have listed its hard to provide support as we really have no idea why it could be breaking down. You may also want to check the event logs on your system to verify that apache is actually starting and stopping. Is apache actually running? Is php running? Is it being loaded correctly?

There is a million things that can go wrong and with the limited info we have, there is no way we can pinpoint the problem.