Could not connect to the database. Connector returned number

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.
pythagoras
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Aug 30, 2011 10:06 pm

Re: Could not connect to the database. Connector returned nu

Post by pythagoras » Wed Aug 31, 2011 2:39 pm

i blanked root password; install proceeded...after completion, hitting site button causes a full page of errors to appear above the page (which shows if you scroll down past the errors. My own Windows server 08 r2,

"Strict Standards: Static function JDatabase::test() should not be abstract in C:\xampp\htdocs\Joomla\libraries\joomla\database\database.php on line 350

Strict Standards: Accessing static property JCache::$_handler as non static in C:\xampp\htdocs\Joomla\libraries\joomla\cache\cache.php on line 394

Strict Standards: Accessing static property JCache::$_handler as non static in C:\xampp\htdocs\Joomla\libraries\joomla\cache\cache.php on line 396

Strict Standards: Accessing static property JCache::$_handler as non static in C:\xampp\htdocs\Joomla\libraries\joomla\cache\cache.php on line 396"

as examples

olivierdb
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sun Jun 20, 2010 5:23 pm

Re: Could not connect to the database. Connector returned nu

Post by olivierdb » Wed Aug 31, 2011 4:42 pm

My installation finally worked, but I'm not sure why!?!

All I can say is that:

1) I created the database from the terminal first
2) I only used 3 letters for the name of the database
3) I did not leave the password blank (that would not work!)
4) I used 5 letters (including the '_' at the end) for the tables prefix
5) I used 'localhost' for the host name and 'root' for the username
6) I used MySQLi
7) I selected 'Remove' for the old database process

Hope these settings help!

qgidave
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Wed Aug 24, 2011 6:32 am

Re: Could not connect to the database. Connector returned nu

Post by qgidave » Wed Aug 31, 2011 7:20 pm

FWIW, if you are installing JOMMLA and using "root" as the MYSQL user then do not enter a password.

When MYSQL is installed it sets up a user "root" with no password.

HTH....

go4th
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Thu May 14, 2009 2:13 pm

Re: Could not connect to the database. Connector returned nu

Post by go4th » Tue Sep 13, 2011 2:38 pm

Thanks to Ayougoudou,

This resolved my issue. In my case, I was using JMS2Win Multisites and was getting this error when attempting to install Joomla 1.7 to a slave site (sub-domain.) Ayougoudou wrote:
You should be aware that not all host name is localhost; this is what worked for me:

- login to your cpanel account
- look for MySql Icon and click it
- read that page and you will find your host name there.
If you do not find it then contact your hosting company for the host name.
Using a shared server, my ISP apparently assigns the SQL database name and it was nothing like the name I assigned. I only see the name I assign in cpanel to select the desired database. Mine was very long and cryptic. somerandomnumbers.db.numbers.someplace.com
Once I entered this as the Host Name, I no longer received the error and was able to continue the installation.

User avatar
RenewGuru
Joomla! Intern
Joomla! Intern
Posts: 76
Joined: Thu Mar 11, 2010 1:34 am

Re: Could not connect to the database. Connector returned nu

Post by RenewGuru » Fri Sep 16, 2011 3:01 pm

Just completed a Joomla 1.7 install using WAMP 2.1 and had to quit Skype in order for this to work. Set the username to root with no password and was able to complete the install. However, I have been trying to install some new templates with the standard Joomla installer but I get no completion or error message when it finishes and it is not installing the templates. Tried just placing the template folders into the Templates folder of Joomla and still it is not seeing them so that I can default any of them for use in the site. The installer doesn't have any issues while installing 1.7 compatible extensions such as Chronoforms or JCE editor but it doesn't seem to do anything for installing templates. Any ideas on what the problem is or the solution?

qgidave
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Wed Aug 24, 2011 6:32 am

Re: Could not connect to the database. Connector returned nu

Post by qgidave » Sun Sep 18, 2011 4:52 pm

I have tried the same - just placing templates in the folder - with the same empty results.
Then I found that I had to "Discover" the template(s) using the menu item on the extensions management page of the back end administrator. Once "Discovered" I could then install and everything worked.

hth,
Dave

jasonygp
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Sep 19, 2011 9:50 am

Re: Could not connect to the database. Connector returned nu

Post by jasonygp » Mon Sep 19, 2011 9:55 am

patomckinney wrote:I am using godaddy shared linux hosting. I was getting this error. I put the ip address in for the database instead of db.xxxx.hostedresource.com. Also I I copy and pasted the addresses into to notepad first. Then it worked.
Yes,it worked.Thx!

violetlobster
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Sep 20, 2010 11:54 pm

Re: Could not connect to the database. Connector returned nu

Post by violetlobster » Wed Sep 28, 2011 2:37 pm

Ayougoudou wrote: You should be aware that not all host name is localhost; this is what worked for me:
- login to your cpanel account
- look for MySql Icon and click it
- read that page and you will find your host name there.
Perfect! I was trying to install Joomla! 1.7 - changing 'localhost' to the host name listed in the SQL panel details solved my problem. THANK YOU! :D

mikerpugh
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Fri Sep 30, 2011 6:03 am

Re: Could not connect to the database. Connector returned nu

Post by mikerpugh » Fri Sep 30, 2011 6:07 am

I have been working through several suggestions and my issue was resolved by changing the host to 127.0.0.1 instead of localhost. I hope this helps.

WSRyu
Joomla! Apprentice
Joomla! Apprentice
Posts: 49
Joined: Sun Nov 29, 2009 5:46 pm

Re: Could not connect to the database. Connector returned nu

Post by WSRyu » Sun Oct 02, 2011 11:14 am

ive installed it on my localhost and using no password worked for me.

User avatar
RCheesley
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 181
Joined: Tue Apr 24, 2007 11:53 am
Location: Ipswich, Suffolk, UK
Contact:

Re: Could not connect to the database. Connector returned nu

Post by RCheesley » Fri Oct 14, 2011 8:53 am

From my experience this kind of error is almost always due to incorrect information being entered, which means that the database connection cannot be made.

Things to check as suggested include:

Is the database type correct (MySQL or MySQLi) - I've not experienced a problem with this as my hosts all support MySQLi. You should be able to see on the right hand side of phpMyAdmin if MySQLi is supported)[/list]

Is the hostname correct - normally this is localhost or 127.0.0.1 (which == localhost), but sometimes your database server might be hosted on another machine, so you'll need to enter this as a web address or IP. Normally if this is the case, you can find out the information by going to phpMyAdmin and copying the first part of the address

Is the username correct? Many hosting companies will prefix the username you enter with your hosting account username followed by an underscore (e.g. myhost_myusername). In a local installation using wamp/xampp/mamp this will nearly always be root, unless you've set it up differently.

Is the password correct? Remember it's case sensitive, and you should be using a randomly generated password here for a live site so make sure your copy/paste is not picking up extra characters along the way. For a local installation using wamp/xampp/mamp this will almost always be blank - unless you've configured it differently.

As with the username, the database name is often prefixed by your hosting account username followed by an underscore (e.g. myhost_mydatabasename) - make sure you've got this bit right

Table prefix - shouldn't make any difference as this is telling the script what prefix to append to table names

Old database process - This tells the scripts what to do if it finds existing Joomla! tables - back them up or remove them. You should only need to worry about this if you do have existing tables

Other things that often break this stage are

Not giving the user access to the database (you do this under the MySQL database section of CPanel, scroll down to the bottom and choose the right username/password, and assign the user full access to the appropriate database

Not having actually created the database/user beforehand (on a live site)

Hope this helps someone!

Ruth
Ruth Cheesley

AndyPacker
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Oct 17, 2011 12:01 pm

Re: Could not connect to the database. Connector returned nu

Post by AndyPacker » Mon Oct 17, 2011 12:04 pm

I had the same problem too. I was able to resolve it by entering root with no password and the installation proceeded.

- Thanks CPUHelp for the tip!

ruudi
Joomla! Intern
Joomla! Intern
Posts: 63
Joined: Sun Apr 13, 2008 2:24 pm

Re: Could not connect to the database. Connector returned nu

Post by ruudi » Thu Oct 20, 2011 1:31 pm

thanks to all the posters....

I did the same... I set my DB as Joomla, root with no password

worked

george

User avatar
daverii
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Fri Mar 06, 2009 4:20 pm
Location: Switzerland, UK & France
Contact:

Re: Could not connect to the database. Connector returned nu

Post by daverii » Thu Oct 27, 2011 4:33 pm

For CPanel/WHM users
  • Do not choose the combination of root and no password - Serious security risk.
  • Do set up a database using the MySQL wizard on your control panel.
  • Database names must be less than 16 characters long.
  • During the wizard choose a suitable username and strong password.
  • Return to the Joomla install database page and enter those values.
  • Select the random prefix offered by the installer.
  • Somewhere take a note of all these parameters.
  • Press next and you will be rewarded.
Tony Davis

Wengen, Switzerland

JanSteele
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Thu Oct 13, 2011 3:18 pm

Re: Could not connect to the database. Connector returned nu

Post by JanSteele » Fri Oct 28, 2011 9:54 am

For someone with no knowledge of programming but who wants to learn to use Joomla, is there a way of installing Joomla 172 on my computer locally but effortlessly? I am using MAMP, and I have put the Joomla folder in htdocs. The install wizard starts - but I am always stuck on "can't connect to database". I've tried with and without a password, and I've tried the whole process a couple of times. The issue seems to be the database name. How do I find out what this should be?

User avatar
2ninerniner2
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 3231
Joined: Sun May 25, 2008 8:05 am
Location: Calgary, Alberta, Canada
Contact:

Re: Could not connect to the database. Connector returned nu

Post by 2ninerniner2 » Mon Oct 31, 2011 7:56 am

@JanSteele -

IF you are making it to Step 4 of the Install, the database step, then that means:

- you have at least the Apache Server portion of MAMP running; make SURE that the MySQL Server is running as well (has the green icon in the Status area of the MAMP window; HAS to be the same as the Apache one above it)
- you have the Joomla! files in the correct place: Applications/MAMP/htdocs/Joomla (or whatever you named it)

So, after making SURE the MySQL Server is running:

- here are the values for Step 4:

Database Type = MySQLi (leave as is)

Host Name = localhost (lower case) OR 127.0.0.1

Username = root

Password = root

Database Name = whatever you want; lower case, no spaces - example: j172

Table Prefix = leave as is

Old Database Process = Backup (leave as is)

Here is the Key Point:

YOU HAVE ABSOLUTELY NO OPTIONS AS TO WHAT THE USER NAME AND PASSWORD ARE AT THIS STEP!!! THEY HAVE TO BE AS SHOWN FOR MAMP "OUT OF THE BOX"

These are determined SOLEY by the "flavour" of STACK you are using (MAMP is different from XAMPP, etc.)

SO many folks believe THEY have to choose these here; NOT!!!

The Step where YOU get to choose a User Name and Password is at STEP 6 where you set up ACCESS TO THE ADMIN OF THE SITE ... NOT THE DATABASE!!! :)

Also, it should be noted that with the Joomla! installer, one does NOT need to set up an empty database in advance of the installation ON A LOCAL INSTALL ONLY!!! You still have to do so when setting up one on a remote, hosted server, BUT NOT LOCALLY WITH JOOMLA! ... however, you DO LOCALLY, with WordPress, Drupal, eFront, Moodle, etc., etc.
@snifflevalve

mashayo
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Sun Nov 20, 2011 2:42 pm

Re: Could not connect to the database. Connector returned nu

Post by mashayo » Sun Nov 20, 2011 3:12 pm


Dear Friends,

The issue here is not XAMP, LAMP, WAMP nor Joomla itself. It is the matching of details-One to One Matching. As one way of improving security, Joomla 1.7 will not accept general host details such as % under host name. To cut the story short. Do the following:-


1.Create the data base first;
2. Change the default database type from MySQLi to MySQL;
3. Use a unique user name, avoid using root or blank password
4. For table Prefix, you may wish to use the default one or change it to the suitable one but it must be very short;
5. Then go to your MySQL database setting and change the host-name from the default localhost to exact IP address such as 127.0.0.1 for local servers.


Once you do that your done. I did that several times successfully. The important thing is to be specific on details especially the IP address and user name, they must match with what is available in the database.

All the best,

Edwin Mashayo

User avatar
Bansaw
Joomla! Intern
Joomla! Intern
Posts: 92
Joined: Sat May 05, 2007 9:21 am

Re: Could not connect to the database. Connector returned nu

Post by Bansaw » Mon Nov 21, 2011 9:22 pm

This is what worked for me:

1) Switched the php version to 5.3 (in my host control panel)
2) Created a blank mysql database MANUALLY from the host control panel
note: my host did not let me use ROOT as a username.

finally, it worked.Praise the Lord!

Database type= MySQLi
Host Name=localhost
User Name=web177-mydbname
password=mypassword
Database Name=web177-mydbname
Table Prefix=swz6j_

(.) Remove

mvrlik
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Mon Jan 12, 2009 1:27 pm

Re: Could not connect to the database. Connector returned nu

Post by mvrlik » Wed Nov 30, 2011 2:03 am

There's one more catch!

If your database password includes '<', then this character and all subsequent characters are internally REMOVED from the password by Joomla (probably as part of input validation), so in this case you keep getting 'Connector returned number 2' actually due to invalid password.

Example:
password you entered into the input box = 'hello!<all'
password taken from you by Joomla and used for login to database = 'hello!'

So when thinknig about strong database password, avoid '<' and similar HTML-hacking chars which could potentially get filtered in input box. Of course, after the installer finishes, these passwords work perfectly again if you put them directly into config file.

chrstphrmr
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Sun Sep 18, 2011 4:42 pm

Re: Could not connect to the database. Connector returned nu

Post by chrstphrmr » Sat Dec 10, 2011 11:44 pm

I had the same problem with WAMP Server 2.1 and J! 1.6 Stable. What worked for me was, in step 4, using "joomla" as the DB name, "root" as the username, and no password.
This fix worked for me.

soheilta
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Fri Dec 23, 2011 1:40 am

Re: Could not connect to the database. Connector returned nu

Post by soheilta » Fri Dec 23, 2011 1:44 am

The problem is with the password.if you haven't changed it just leave it blank. it'll work

sysopTK
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Tue Dec 27, 2011 11:15 pm

Re: Could not connect to the database. Connector returned nu

Post by sysopTK » Wed Dec 28, 2011 12:03 am

I've tried everything suggested in this thread and nothing works!

I had to create the database before I began installing.

DB Type: tried both MySQL and MySQLi
Host name: the database is hosted on another server. I've tried 'mysql13.000­webhost.com' and its IP address, 'localhost' and 127.0.0.1
Username: I've tried the default 'root' and 'sysop'
Password: Tried leaving it blank and tried the password I specified when I created the database
Database name: 'jdata'
Table prefix: tried the randomly generated prefix and the one created when I created the database

ramadji
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Dec 30, 2011 4:12 pm

Re: Could not connect to the database. Connector returned nu

Post by ramadji » Fri Dec 30, 2011 4:18 pm

Dear All:
I ran into the same error message ("Could not connect to the database. Connector returned 2) and the reason was the fact I used a special character in the DB_user's password. After removing the special character (') from the password, everything proceeded normally and I was able to install Joomla 1.7 without any further problem.
I hope this helps somebody who is struggling with the same issue.

Happy New Year 2012 to you all!

Ram

User avatar
infinitei
Joomla! Intern
Joomla! Intern
Posts: 86
Joined: Mon Mar 13, 2006 8:51 am

Re: Could not connect to the database. Connector returned nu

Post by infinitei » Sat Apr 14, 2012 7:28 pm

I changed the group ownership of my files and folders by mistake and got this same error.

Seems to be a database user/ownership issue
It's not about knowing how to do it, It's about knowing what questions to ask and where to ask them..

User avatar
humvee
Joomla! Master
Joomla! Master
Posts: 14704
Joined: Wed Aug 17, 2005 10:27 pm
Location: Kent, England

Re: Could not connect to the database. Connector returned nu

Post by humvee » Sun Apr 22, 2012 7:50 am

[Mod note]
Locking this topic as it has ranged far from the original posters' issue. To summarise this thread as follows:
1. There were/are issues with some server hosts configuration.
2. Not following the installation guides that are available with regard to the information to enter for the DB password.
3. Changing access/ownership rights to folders.]


Locked

Return to “Installation Joomla! 2.5”