“Database connection error (2): Could not connect to MySQL.”

Joomla versions 2.5, 1.7 and 1.6 are all end-of-life since December 31st 2014 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
claudiog
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Sep 26, 2014 7:13 pm

“Database connection error (2): Could not connect to MySQL.”

Post by claudiog » Tue Sep 30, 2014 6:06 pm

Greetings,

I’m new with Joomla and having problems within a process to install a CRM (suiteCRM) which use Joomla. I couldn’t arrive at the step to install the crm because the problem appears before it. I hope someone could help me because I read all forums, documents, papers, and did many things. Also install and re-install Joomla many times. Now I have some ideas after read many posted issues related with the following problem message, but these issues are not exactly as I have, and also I have no experience with web servers, content managers, PHP interpreters and data bases.

 Problem:

The problem appears when I tried to invoke Joomla, and a new tab browser appears with the message below:

“Database connection error (2): Could not connect to MySQL.”

It happened after reset the db admin password with a Database Manager Tool of the web hosting service provider (GoDaddy).

 Enviroment:

IT Service Provider: GoDaddy
IT Context: Web Hosting with not dedicated servers
O.S.: Linux
Web Server: Apache
Content Manager: Joomla V.2.5.14
Interpreter: PHP V.5.3
Data Base: MySQL V.5.0 (With direct access not allowed)

Note: - Joomla and MySQL are provided by GoDaddy.
- GoDaddy information says “Hosting configuration: 2.2”. Perhaps is the
Apache version.

 Steps:

After several install and re-install activities, the most accurate procedures that describe how I did it, are these:
1. I created a domain
2. Under my “Webroot” directory, I created a sub-directory.
3. I created a sub-domain pointing to <webroot/sub-directory>.
4. Through my GoDaddy control panel and under applications menu, I selected Joomla application to install.
5. Within Joomla install process, it requested the following data:
 Domain <sub-domain>.< domain>
 Installing directory <webroot/sub-directory>
 Username <Joomla user name>
 Password <Joomla user password>
 Sample template (data to be incorporated or something like this)
6. After finished, I got into the GoDaddy control panel and through it, I selected application manager. It gave me this information:
 Version 2.5.14
 Admin URL http://<sub-domain>/Administrator
 Username <Joomla user name>
 Password <Joomla user password>
 Current Directory /
 Database <database name>

IMPORTANT:
- Username is Joomla administrator as a super user, and It was created same as I wrote it.
- Password is Joomla administrator password and It was created same as I wrote it.
- With GoDaddy, DB user name is same as the DB name.
- With GoDaddy, DB user password is data NOT provided to me.

7. Then, I got into the GoDaddy control panel again, and through it, I selected database manager. It gave me this information:
• Database and username <database name>
Note: Only one name because the process created same name for both, Database and Username.
• Admin URL (phpMyAdmin)
• Hostname <database name>.db.<xxxx>.<remote host name>.com
Note: <remote host name> I assume that is a remote host name
8. Through the control panel, I made a database backup
9. Considering that through Joomla la MySQL was created, I access to Joomla through control panel again, with <Joomla user name> and <Joomla user password> first. I HAD NO PROBLEM !!!. It looked everything OK.
10. I tested to access Joomla again through its Admin URL (http://<sub-domain>/Administrator), same user and password; and also had no problem. So Joomla access has no problem by both ways.
11. After that, I tried to login to database through control panel (phpMyAdmin). A login page appear requiring User and Password.

IMPORTANT:
- I know that the database user is <database name>, but I had not password. I tried to access with Joomla password, but of course, it didn’t work.
 Additional information:

- Config file “configuration.php” (after installation and most related part fo the file to this issue)

/* Site Settings */
public $offline = '0';
public $offline_message = 'This site is down for maintenance.<br /> Please check back again soon.';
public $display_offline_message = '1';
public $offline_image = '';
public $sitename = '<sub-domain>.< domain>'; // Name of Joomla site[/b][/b]
public $editor = 'tinymce';
public $captcha = '0';
public $list_limit = '20'; //public $root_user = '42';
public $access = '1';

/* Database Settings */
public $dbtype = 'mysql'; // Normally mysql
public $host = '<database name>.db.<xxxx>.<remote host name>.com'; // This is normally set to localhost
public $user = '<database name>'; // DB username
public $password = '<database password>'; // DB password
public $db = '<database name>'; // DB database name
public $dbprefix = 'jos_'; // Do not change unless you need to!

NOTE: I modified sitename, host, user, password and db manually only in this post to simplify information. It will be avaiable at any request.

 Considerations:

1. I can reset data base user password from GoDaddy control panel

2. I’m limited of what can I do with my files in the Web Hosting

3. I can not access to Linux commands.

4. In my several installation and re-installation, I could access to phpMyAdmin and looks like everything normal, but of course after that, I couldn’t access to Joomla.

5. I found a document that explain in detail a work around with 2 methods to solve this issue, but for me didn’t work. Due my ignorance on these applications, I don’t discard a possibility that I follow it unproperly.


 Additional questions:

1. Is <database name> as a user only for connection between Joomla and MySQL ?. Is <database name> a database MySQL administrator name ?

2. In my several installation and re-installation, I could enter to phpMyAdmin and looks like everything normal, but of course after that, I couldn’t access to Joomla.

I’ll appreciate any help on this matter.

Thanks so much.

claudiog.
Last edited by claudiog on Wed Oct 01, 2014 7:36 pm, edited 2 times in total.

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17426
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: “Database connection error (2): Could not connect to MyS

Post by toivo » Wed Oct 01, 2014 5:59 am

I suggest that you edit your post urgently, remove specific usernames and passwords, to save the time of one of the moderators.
having problems within a process to install a CRM (suiteCRM) which use Joomla
How does the suiteCRM application "use" Joomla?

Joomla 2.5.14 is quite old. if you are using Joomla, you should install the latest version 3.x.
“Database connection error (2): Could not connect to MySQL.”

It happened after reset the db admin password with a Database Manager Tool of the web hosting service provider (GoDaddy).
If you change the database name, connection details or the username and password of the user that your Joomla installation uses to connect to the database server, you need to make identical changes to the file configuration.php by editing it manually because the moment the changes are done in the hosting cPanel or similar, your Joomla site is unable to connect and reports a database connection error.
Toivo Talikka, Global Moderator

claudiog
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Sep 26, 2014 7:13 pm

Re: “Database connection error (2): Could not connect to MyS

Post by claudiog » Thu Oct 02, 2014 8:21 pm

Hi toivo.

Thanks a lot for your help. Perhaps I didn´t find how to resolve this issue in particular with the enviroment as I had at the beginning. But, I took your recomendations and I had no problems !!!.

1- I uninstalled the Joomla 2.5 that the web service provider has, which when I install Joomla, it comes with MySQL as only one procedure. IMPORTANT: This procedure never gave me the database user password.
2- I erased all files under sub-domain directory.
3- I Followed the installation guide for Joomla 3.3.6 downloaded from Joomla web site as I describe below:
a- I checked versions of Apache, PHP and MySQL needed.
b- I Installed PHP 5.4 instead PHP 5.3 both provided by the web hosting provider.
c- I installed MySQL 5.5 (ALONE), instead of MySQL 5.0 both provided by the web hosting
provider. I gave the database username and database userpassword.
d- After that, I unpacked Joomla into the installation subdirectory, downloaded from Joomla
web site before.
e- I Installed Joomla through its install page and I gave a Joomla Super User name and password.

What it is importante, is that in this case, I had the database user password before Joomla installation, and let me use it in Joomla installation. I did not need to make any special workarround to fix something.

Thanks again.

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17426
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: “Database connection error (2): Could not connect to MyS

Post by toivo » Thu Oct 02, 2014 8:29 pm

Cheers - good to hear that the installation went all right.

You could also edit the first post in this thread and select the green tick as the icon to mark the issue resolved.
Toivo Talikka, Global Moderator


Locked

Return to “Installation Joomla! 2.5”