Jump to content

[SOLVED] Non localhost connect


53329

Recommended Posts

I tried the example here: http://ca3.php.net/function.mysql-connect

 

<?php
// we connect to example.com and port 3307
$link = mysql_connect('example.com:3307', 'mysql_user', 'mysql_password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);

// we connect to localhost at port 3307
$link = mysql_connect('127.0.0.1:3307', 'mysql_user', 'mysql_password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?> 

 

 

I tried both the port it gave and my cpanel port (2082).  The cpanel one took longer but yielded similar results.

 

 

With port as 2082:

 

Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on '********.net' (4) in /home2/mark/public_html/test.php on line 3

Could not connect: Can't connect to MySQL server on '********.net' (4)

 

With port as 3307:

 

Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server during query in /home2/mark/public_html/test.php on line 3

Could not connect: Lost connection to MySQL server during query

 

 

Server info is as folows:

Operating system: Linux

Apache version:1.3.37 (Unix)

PHP version:4.4.7

MySQL version:4.1.22-standard

 

 

I'm thinking maybe I need to enable something?  That or maybe my host has a problem with it.  Or I'm not using the correct port.  There is very very little information on this that I can find so any help would be greatly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/75562-solved-non-localhost-connect/
Share on other sites

Yeah I replaced the login info.  I tried the IP with no port and got the error:

 

Warning: mysql_connect() [function.mysql-connect]: Access denied for user '*****'@'server5.hostprestige.com' (using password: YES) in /home2/dan/public_html/test.php on line 3

Could not connect: Access denied for user '*****'@'server5.hostprestige.com' (using password: YES)

 

Host Prestige is my host and the name of the server itself is server5 (according to my cpanel).

 

Edit: and the same thing happens if I put in the domain with no port.  Same error message.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.