Welcome Guest, Not a member yet? Register   Sign In
MySql Can't connect from CodeIgnitor
#1

[eluser]Auzette[/eluser]
Hey there. Just getting into PHP using CodeIgniter. I have a MySql server that is hosted that I'm attempting to create a database connection to from my PHP controller.

The error I get is

Code:
Unable to connect to your database server using the provided settings.

Filename: C:\Users\gwen\albion\system\database\DB_driver.php

I have set the settings for my database, username, password, and port in database.php. I print those out in the function in DB_Driver.php and so I know that the information is populated correctly.

Code:
Sample output I print to page:
name: albert
password: 1nacan
server: 42.8.16.73
port: 3306

I have installed MySql Workbench 5.2, and using the same settings I'm able to connect and get to the database fine.

I'm running CodeIgniter 2.1. The mysql version is 5.1.

Is there any information I can get further than "Unable to connect"? Any debug mode that will give me a more specific error that I can try and figure out precisely where the inability to connect lies? It may be that I need to provide further information, but without knowing exactly what information that is, I'm kind of shooting blindly.

Any ideas appreciated. The work in CodeIgniter has gone quite smoothly, so hopefully this is something that has a quick solution.

Thanks!


#2

[eluser]CroNiX[/eluser]
See this post for some deeper debugging.
#3

[eluser]Auzette[/eluser]
Thanks for the extra code. It is MUCH more informative. I'm getting this:

Code:
Line: 82 : mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file

Line: 88 : No connection could be made because the target machine actively refused it.

So at least I can start researching what's going on now... Thanks!
#4

[eluser]Auzette[/eluser]
And in case anyone else runs into the error, and they're on a hosted server, this article shows the resolution.

http://stackoverflow.com/questions/15758...entication




Theme © iAndrew 2016 - Forum software by © MyBB