CodeIgniter Forums
I can't connect to mysql - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: I can't connect to mysql (/thread-25336.html)

Pages: 1 2


I can't connect to mysql - El Forum - 12-08-2009

[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.


I can't connect to mysql - El Forum - 12-08-2009

[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_connect_using_mysql.htm for info on how to do this!


I can't connect to mysql - El Forum - 12-08-2009

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

Enjoy
InsiteFX


I can't connect to mysql - El Forum - 12-09-2009

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


I can't connect to mysql - El Forum - 12-09-2009

[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;


I can't connect to mysql - El Forum - 12-09-2009

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


I can't connect to mysql - El Forum - 12-09-2009

[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;


I can't connect to mysql - El Forum - 12-09-2009

[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.


I can't connect to mysql - El Forum - 12-09-2009

[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;


I can't connect to mysql - El Forum - 12-09-2009

[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