CodeIgniter Forums

Full Version: I can't connect to mysql
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2

El Forum

[eluser]mikevu[/eluser]
Hello everyone,
all my code is done in my localhost (my PC). But it is don't connect to mysql in my host when I deploy in my host.
mysql in this is host using port 3307.
This is my database config.
Code:
$db['default']['hostname'] = "localhost";
$db['default']['port'] = "3307";
$db['default']['username'] = "root";
$db['default']['password'] = "xxxroot";
$db['default']['database'] = "vos_xxx";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
Some site in this host is done very well
any one help me?
Thank you so much.

El Forum

[eluser]Cro_Crx[/eluser]
Assuming your using mysql (like you've set) try connecting with the mysql command line tool to see if that works. If it doesn't connect then that's going to be the problem.

http://www.cryer.co.uk/brian/mysql/howto..._mysql.htm for info on how to do this!

El Forum

[eluser]InsiteFX[/eluser]
Another thing what are you using WAMP, XAMMP or LAMP?

Enjoy
InsiteFX

El Forum

[eluser]mikevu[/eluser]
I am using Phpmyamin to create database, its is so good.

El Forum

[eluser]John_Betong[/eluser]
 
I use this test code in all my ./config/database.php files:
Code:
$link = &mysql;_connect
                (
                    $db['default']['hostname'],
                    $db['default']['username'],
                    $db['default']['password']
                    // FALSE,
                    // 128
                );
            
if (!$link) {
  die('Not connected : ' . mysql_error());
}

// check the current db
$db_selected = mysql_select_db($db['default']['database'], $link);
if (!$db_selected) {
    die ('Can\'t use <b>' .$db['default']['database'] .'</b> : ' . mysql_error());
}
&nbsp;
&nbsp;
&nbsp;

El Forum

[eluser]mikevu[/eluser]
Still don't work now. any one helpme?

El Forum

[eluser]John_Betong[/eluser]
[quote author="mikevu" date="1260367864"]Still don't work now. any one helpme?[/quote]
&nbsp;
It is not easy trying to diagnose your problem from my where I am sitting Smile

What are the error messages are generated?
&nbsp;
&nbsp;

El Forum

[eluser]mikevu[/eluser]
It works done in my PC,port of mysql is 3306.
in my host mysql's port is 3307 --&gt; Don't connect to database.

El Forum

[eluser]John_Betong[/eluser]
[quote author="mikevu" date="1260371150"]It works done in my PC,port of mysql is 3306.
in my host mysql's port is 3307 --&gt; Don't connect to database.[/quote]
&nbsp;
I have never used or needed to set the port. I have just set the database, user and password and it works everytime both on WAMP, XAMP and on quite few on-line hosts.

Have you tried without setting the port?

What error messages are returned?
&nbsp;
&nbsp;

El Forum

[eluser]mikevu[/eluser]
I can't reset the port because there are a lot of websites are running in the Server.
The website are done very well in my PC with default port of mysql (3306).
I think it may be issue of CI
Pages: 1 2