Cannot connect to Mysql database!

Joomla version 1.5 is end-of-life and are no longer supported. Please use Joomla 3.x instead.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
ashley1493
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Wed Oct 22, 2014 5:37 pm

Cannot connect to Mysql database!

Post by ashley1493 » Sat Nov 29, 2014 3:33 pm

So, I am pretty new to Joomla! and I have been asked to create a development site for the company I work for and then upgrade and migrate the development site to the most up to date version of Joomla! to see how our site is affected. I have tried multiple things to try to create this development site and still haven't been able to....created backup of files and exported the database to my localhost....However, now after trying a few things I seem to have affected our live site from connecting to the database and I don't understand how. I never touched the files or the database of the site but this message shows when I go to the site. I did alter the database on my localhost using wamp and xampp but it was trying to create the development site...

Database Error: Unable to connect to the database:Could not connect to MySQL


I checked the configuration file from file manager in our cpanel and it has all the correct information. I also checked the the database in phpmyadmin and all the tables are still there as well.

Can someone please help me figure out why our site is not connecting to the database.

User avatar
sikumbang
Joomla! Ace
Joomla! Ace
Posts: 1589
Joined: Fri Aug 19, 2005 4:37 am
Location: earth
Contact:

Re: Cannot connect to Mysql database!

Post by sikumbang » Sat Nov 29, 2014 3:57 pm

Have you checked with your hosting provider? Maybe your MySQL server is down?
http://www.templateplazza.com - Joomla Templates and Extensions

ashley1493
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Wed Oct 22, 2014 5:37 pm

Re: Cannot connect to Mysql database!

Post by ashley1493 » Sat Nov 29, 2014 4:18 pm

I am trying to get a hold of them now to find out.

Would me altering the database on my local servers phpmyadmin affect the live site at all?

ashley1493
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Wed Oct 22, 2014 5:37 pm

Re: Cannot connect to Mysql database!

Post by ashley1493 » Sat Nov 29, 2014 4:35 pm

I contacted them and the server isn't down. Is there somewhere else I can check to see what the problem might be?

jcms
I've been banned!
Posts: 2233
Joined: Wed Nov 19, 2014 9:23 am

Re: Cannot connect to Mysql database!

Post by jcms » Sat Nov 29, 2014 5:31 pm

- create database and user well?
- add user full permission to database
- input all info to your configuration.php file
what is your link site and we can look?

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30937
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Cannot connect to Mysql database!

Post by Per Yngve Berg » Sat Nov 29, 2014 7:06 pm

Why are you using an outdated version of Joomla? Joomla 1.5 may not run on servers with newer versions of php and mysql.

ashley1493
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Wed Oct 22, 2014 5:37 pm

Re: Cannot connect to Mysql database!

Post by ashley1493 » Sat Nov 29, 2014 8:49 pm

jcms wrote:- create database and user well?
- add user full permission to database
- input all info to your configuration.php file
what is your link site and we can look?

The user has full permission and all the correct info is in the configuration file. Everything was working fine until i tried creating a development site on my local server. That is were I altered the config and database file but never imported it into the phpmyadmin for my live site.

We know we are using an outdated version but that is why I am trying to create the development site so we can test out the migration process before applying to the live site.

User avatar
dpacadmin
Joomla! Champion
Joomla! Champion
Posts: 6029
Joined: Sat Aug 16, 2008 1:46 pm
Location: the Bat Cave
Contact:

Re: Cannot connect to Mysql database!

Post by dpacadmin » Sun Nov 30, 2014 12:49 am

Check the permissions and ownership on your live site's configuration.php file, perhaps you edited it or uploaded it via FTP which could have changed ownership or permissions.

Changes to your local site will not effect your live site but it is possible to confuse the two sites and change the wrong files or database, has happened before to others.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30937
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Cannot connect to Mysql database!

Post by Per Yngve Berg » Sun Nov 30, 2014 8:27 am

Check that the ftp layer is not enabled. One user had the host name specified and changed the live site by ftp when editing configuration.php.

ashley1493
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Wed Oct 22, 2014 5:37 pm

Re: Cannot connect to Mysql database!

Post by ashley1493 » Tue Dec 02, 2014 2:19 pm

In the configuration.php file, is there supposed to be something in the var $live_site field? I checked if ftp was enable and there is a '0' in the value so I am assuming that it isn't. Which field would you edit the permissions in?

ashley1493
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Wed Oct 22, 2014 5:37 pm

Re: Cannot connect to Mysql database!

Post by ashley1493 » Wed Dec 03, 2014 3:17 pm

Does the htaccess file have any affect on the connection to the database?

User avatar
dpacadmin
Joomla! Champion
Joomla! Champion
Posts: 6029
Joined: Sat Aug 16, 2008 1:46 pm
Location: the Bat Cave
Contact:

Re: Cannot connect to Mysql database!

Post by dpacadmin » Wed Dec 03, 2014 5:58 pm

No, not unless the htaccess is redirecting the url to another install with a database connection issue. The configuration.php file contains the database connection details, check with your Host to see if the database server address has changed. The default is "localhost" but some Hosts use a full url to a dedicated MySQL server and if they change the url then there would be a connection issue.

ashley1493
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Wed Oct 22, 2014 5:37 pm

Re: Cannot connect to Mysql database!

Post by ashley1493 » Wed Dec 03, 2014 6:07 pm

I already contacted our host and they said nothing has changed on their end. I have been trying a lot of different things to create my development site so I am almost certain I must have done something for it not to connect to the database. I just can't recall exactly when the site stopped connecting to the database. Here is my configuration.php settings. Is there something that seems off or might need to be changed?

var $log_path = '/public_html/logs';
var $tmp_path = '/public_html/tmp';
var $live_site = '';
var $ftp_enable = '0';
var $ftp_host = '127.0.0.1';
var $ftp_port = '21';
var $ftp_user = '';
var $ftp_pass = '';
var $ftp_root = '';
var $dbtype = 'mysql';
var $host = 'localhost';
var $user = 'XXXXXXXXX';
var $db = 'XXXXXXXXXX';
var $dbprefix = 'jos_';

User avatar
dpacadmin
Joomla! Champion
Joomla! Champion
Posts: 6029
Joined: Sat Aug 16, 2008 1:46 pm
Location: the Bat Cave
Contact:

Re: Cannot connect to Mysql database!

Post by dpacadmin » Wed Dec 03, 2014 6:11 pm

Give this info to your Host and ask them why the site will not connect, with the correct info replacing the xxxx
var $dbtype = 'mysql';
var $host = 'localhost';
var $user = 'XXXXXXXXX';
var $db = 'XXXXXXXXXX';
var $dbprefix = 'jos_';

ashley1493
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Wed Oct 22, 2014 5:37 pm

Re: Cannot connect to Mysql database!

Post by ashley1493 » Wed Dec 03, 2014 6:16 pm

Before I do that, I know you mentioned something about the permissions possibly being changed when you upload the configuration.php file through FTP. I do remember re-uploading the file so where would I check to see if these setting where changed?

User avatar
dpacadmin
Joomla! Champion
Joomla! Champion
Posts: 6029
Joined: Sat Aug 16, 2008 1:46 pm
Location: the Bat Cave
Contact:

Re: Cannot connect to Mysql database!

Post by dpacadmin » Wed Dec 03, 2014 6:48 pm

In FileZilla if you look in the box on the right that displays your Host's files when connected you will see a column for "Permissions" and one for "Owner/Group". The folders should be 755 and files 644 for permissions, I have seen the configuration.php file at 444 (this blocks changes to the file)for security but it would need to be changed to 644 to make changes to it through the admin backend's "Global Configuration" settings.

The Ownership/Group of all the files and folders should be the same, if some are not it could be that they are no accessible to the other site files. It is easiest to ask your Host to set all permissions and ownership correctly rather than try to do it through FileZilla.

ashley1493
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Wed Oct 22, 2014 5:37 pm

Re: Cannot connect to Mysql database!

Post by ashley1493 » Wed Dec 03, 2014 6:56 pm

I see what you are referring to. All the permissions for the folder and files are correct but for the owners/groups there is one folder that is different from all the rest.

User avatar
dpacadmin
Joomla! Champion
Joomla! Champion
Posts: 6029
Joined: Sat Aug 16, 2008 1:46 pm
Location: the Bat Cave
Contact:

Re: Cannot connect to Mysql database!

Post by dpacadmin » Wed Dec 03, 2014 7:05 pm

Unless it is the administrator folder and you are getting the error when trying to log into the backend I don't think it would be the problem, although if it is one of the core Joomla folders, includes, libraries, or media it may be the issue. You are working on a dev site, do you have a working live site on that Host? Can you compare the configuration.php files for them to see if the dev one is different then the live one?

I have seen where people have edited their configuration.php file in a non text only editor, Dreamweaver for one, and that broke the config file but it was a different error. Could be your file is broken in a way that only produces the can not connect error?

If you PM me the configuration.php file I will have a look at it and see if I find an issue with it.

ashley1493
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Wed Oct 22, 2014 5:37 pm

Re: Cannot connect to Mysql database!

Post by ashley1493 » Wed Dec 03, 2014 7:18 pm

I guess maybe I didn't explain what I have been doing enough.It isn't the back end that I am trying to access, it's our actual live site. I have been trying to create a development site but I haven't been successful. The last step I recall was copying the files to xammp and then when I went to find the site on my local host, that same messaged popped up instead saying it couldn't connect to the database, so I deleted the files from there. I then recently notice our live site was affected as well and was displaying the same message. I did edit the configuration.php file with notepad ++ and then uploaded it through FTP, I don't think that would break the config file but I'm not sure.

User avatar
dpacadmin
Joomla! Champion
Joomla! Champion
Posts: 6029
Joined: Sat Aug 16, 2008 1:46 pm
Location: the Bat Cave
Contact:

Re: Cannot connect to Mysql database!

Post by dpacadmin » Wed Dec 03, 2014 7:28 pm

To send the file click on the PM button at the bottom of this post, it will allow a private chat so you can send the file as an attachment. If you could, also send a link to the live site that is down.
For your dev site on Xampp make sure MySQL is running, I use Wamp so not sure where to check that but with Wamp you just click on the Tray icon for Wamp to check if the services are running.


Locked

Return to “Installation 1.5”