|
You last visited: Today at 06:41
Advertisement
MySQL Connection Error
Discussion on MySQL Connection Error within the EO PServer Hosting forum part of the Eudemons Online category.
08/31/2011, 14:47
|
#1
|
elite*gold: 0
Join Date: Sep 2010
Posts: 340
Received Thanks: 201
|
MySQL Connection Error
Hey guys..i have a MySQL Error.I have DELETE my.ini & MySQL Admin is GREEN LIGHT.I also have the some problem when im trying to make site & forum.Im using WAMP.Here the pic:
SITE PROB:
MySQL Admin GREEN LIGHT:
Although my MySQL cannot connect,but i still can open the database:
IM BEGGING GUYS,PLEASE HELP...
|
|
|
08/31/2011, 15:00
|
#2
|
elite*gold: 0
Join Date: Sep 2010
Posts: 134
Received Thanks: 105
|
If I remember correctly, You wouldn't be able to open the DB if MySQL was not connecting, And Looks to me that its clearly connecting. Now, on the site problem, I don't use wamp so I can't help you there. Sorry x.X
Also Posting your index.php code may help getting your issue resolved.
|
|
|
08/31/2011, 15:04
|
#3
|
elite*gold: 0
Join Date: Sep 2010
Posts: 340
Received Thanks: 201
|
index.php
Quote:
<?php
$p = $_GET['id'];
if ( !empty($p) && file_exists('./web/' . $p . '.php') && stristr( $p, '.' ) == False )
{
$file = './web/' . $p . '.php';
}
else
{
$file = './web/main.php';
}
include $file;
?>
|
config.php
Quote:
<?php
// generated May 24, 2010 19:25:31
// mysql server details
define('host', 'localhost'); // Your database host
define('user', 'root'); // Your database username
define('pass', 'test'); // Your database password
define('mydbdata', 'my'); // Your database name my
define('mydbacc', 'account'); // Your database name account
define('serveraddress', '5.66.**.***'); // Your Server address
define('serverport', '3306'); // Your serverport
define('mydb', 'my'); // Your my database
define('servername', 'BlackThunder Online'); // Your Server Name
define('imgdir', 'http://5.66.**.***'); // Your Image dir
define('poweredby', '<a href="http://www.*****************/forum" target="_blank">Powered By Elite4Gaming '); // Dont Delete!
// conect to database
@mysql_connect(host, user, pass) or die('<h1>Unable to connect to database server.</h1>');
@mysql_select_db(mydbdata) or die('<h1>Unable to connect to database server.</h1>');
?>
|
|
|
|
08/31/2011, 15:11
|
#4
|
elite*gold: 0
Join Date: Sep 2010
Posts: 134
Received Thanks: 105
|
Now from the picture i saw before you edited it was that the error was on line 3 so it will be something wrong along this line,
Quote:
try changing this line
Quote:
to
Quote:
and see if that works.
That's all I can really help you with atm. I hope someone can be smarter than me and resolve your problem if mine does not fix it.
|
|
|
08/31/2011, 15:12
|
#5
|
elite*gold: 0
Join Date: Sep 2010
Posts: 340
Received Thanks: 201
|
Quote:
Originally Posted by xTwiztedKidx
Now from the picture i saw before you edited it was that the error was on line 3 so it will be something wrong along this line, That's all I can really help you with atm. I hope someone can be smarter than me and resolve your problem.
|
its ok now...but still cannot connect to db
|
|
|
08/31/2011, 15:19
|
#6
|
elite*gold: 0
Join Date: Sep 2010
Posts: 134
Received Thanks: 105
|
mk just wondering if you tried changing the
Quote:
to
Quote:
and it fixed that error or what you happened to do.
And maybe try changing this
Quote:
|
define('host', 'localhost'); // Your database host
|
to
Quote:
|
define('host', 'hamanchi ip'); // Your database host
|
Maybe that will work, im not at my computer atm i will be in a min and ill look at my config.php and see if everything looks correct.
|
|
|
08/31/2011, 15:24
|
#7
|
elite*gold: 0
Join Date: Sep 2010
Posts: 340
Received Thanks: 201
|
Quote:
Originally Posted by xTwiztedKidx
mk just wondering if you tried changing the
to
and it fixed that error or what you happened to do.
And maybe try changing this
to
Maybe that will work, im not at my computer atm i will be in a min and ill look at my config.php and see if everything looks correct.
|
same
|
|
|
08/31/2011, 15:24
|
#8
|
elite*gold: 0
Join Date: Dec 2010
Posts: 107
Received Thanks: 84
|
new versions of wamp and xampp and appserv not good in mysql connection so use old versions .. like appserv 2.4
|
|
|
08/31/2011, 15:27
|
#9
|
elite*gold: 0
Join Date: Sep 2010
Posts: 340
Received Thanks: 201
|
Quote:
Originally Posted by MoŽtalKing
new versions of wamp and xampp and appserv not good in mysql connection so use old versions .. like appserv 2.4
|
wait..i try
|
|
|
08/31/2011, 15:30
|
#10
|
elite*gold: 246
Join Date: Jan 2008
Posts: 1,712
Received Thanks: 896
|
Change
PHP Code:
@mysql_connect(host, user, pass) or die('<h1>Unable to connect to database server.</h1>');
@mysql_select_db(mydbdata) or die('<h1>Unable to connect to database server.</h1>');
to
PHP Code:
@mysql_connect(host, user, pass) or die('<h1>Unable to connect to database server.</h1>' . mysql_error());
@mysql_select_db(mydbdata) or die('<h1>Unable to connect to database server.</h1>' . mysql_error());
This will give you the mysql error code and tell you where it's failing. At the same time, undo any changes xTwiztedKidx suggested that you have made.
EDIT: Since this really isn't a EO PServer question, but a general PHP/MySQL question, this really should have been posted in the thread where you got your site files from. That way we wouldn't have to ask you to put your index.php in there, the creator of the site could also chime in if he's watching his threads, etc.
|
|
|
08/31/2011, 15:34
|
#11
|
elite*gold: 0
Join Date: Sep 2010
Posts: 134
Received Thanks: 105
|
mk, Well Try using this as your config.php
Quote:
<?php
// generated August 26, 2011 11:13:20
// mysql server details
define('host', 'localhost'); // Your database host
define('user', 'root'); // Your database username
define('pass', 'test'); // Your database password
define('mydbdata', 'my'); // Your database name my
define('mydbacc', 'account'); // Your database name account
define('serveraddress', 'hamanchi ip'); // Your Server address
define('serverport', '5816'); // Your serverport
define('mydb', 'my'); // Your my database
define('servername', 'BlackThunder Online'); // Your Server Name
define('poweredby', 'Powered By *****************'); // Dont Delete!
define('imgdir', 'http://hamanchi ip/'); // Your Image dir
// conect to database
@mysql_connect($myhost, $myuser, $mypass) or die('<h1>Unable to connect to database server.</h1>');
@mysql_select_db(@mydb) or die('<h1>Unable to connect to database server.</h1>');
?>
|
I automaticlly noticed and i didnt say it a bit ago, This line,
Quote:
|
define('serverport', '3306'); // Your serverport
|
is the wrong port. 3306 is the mysql port.
This is the correct port for the server not mysql.
Quote:
|
define('serverport', '5816'); // Your serverport
|
And, I think this line(s) here
Quote:
@mysql_connect(host, user, pass) or die('<h1>Unable to connect to database server.</h1>');
@mysql_select_db(mydbdata) or die('<h1>Unable to connect to database server.</h1>');
|
Should be
Quote:
@mysql_connect($myhost, $myuser, $mypass) or die('<h1>Unable to connect to database server.</h1>');
@mysql_select_db(@mydb) or die('<h1>Unable to connect to database server.</h1>');
|
But try my config (ive edited it so it would be easier for you)and just edit the hamanchi IP spot and try it.
This is pretty much the config that i use, and it does work so i thought maybe that would help.
If it doesnt, Sorry, I tried to help.
And King_Arthur
The site files, by looking at the config, is from the EO section. Just saying.
|
|
|
08/31/2011, 16:17
|
#12
|
elite*gold: 0
Join Date: Sep 2010
Posts: 340
Received Thanks: 201
|
no nothing happens...
look:
register.php:
Quote:
<?php
include('config.php');
?>
<script type="text/javascript" src="./inc/md5.js"></script>
<form method='post' action='register.php?act=register'>
<b><strong><font color=white>Please make sure you remember your Account ID and Password</font></strong></b><hr>
<tr><td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td width="64" valign="top"></td>
<td valign="top">
<table width="100%" border="0" cellspacing="10" cellpadding="0">
<tr><td><strong><font color=white>Account ID:</font></strong></td>
<td width="66%"><input type="text" size="30" maxlength="15" name="id" id="id" title="* Only 4-15 Words/number"></td></tr>
<tr><td><strong><font color=white>Password:</font></strong></td>
<td><input class=it id="ipassword" type="password" size="30" maxlength="15" name=pass title="* Only 4-15 Words/number"></td></tr>
<tr><td><strong><font color=white>Retype Password:</font></strong></td>
<td><input class=it1 id="ipassword" type="password" size="30" maxlength="15" name=retpass title="* Only 4-15 Words/number"></td></tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<br /><br />
<TABLE align="center">
<tr><td align="center"><input type="hidden" name="hash"><input class=Butt type=submit onclick="hash.value = login(pass.value)" value='register' name=B1></td></tr>
</table>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<?php
if($_GET['act'] == "register")
{
mysql_select_db($mydbacc);
$userid = trim($_POST['id']);
$password=trim($_POST['pass']);
$passretype=trim($_POST['retpass']);
$hash=$_POST['hash'];
$_SERVER['REMOTE_ADDR'];
if($userid=="" || $password=="" || $passretype=="" )
{
echo "<center><font color=white>You must fill all information in the Required Field!</font></center>";
}
else
{
if($password == $passretype)
{
if(!ereg("^[0-9a-z]{4,15}$",$userid))
{
echo "<center><font color=white>Only letters and numbers only are allowed.Long 4 to 15 words</font></center>";
}
else
{
$res = mysql_query("select * from account where name = '".$userid."' order by id desc");
if(mysql_num_rows($res) == 0)
{
mysql_query("insert into account (name,Password,Reg_date,netbar_ip) values ('".$userid."','".$hash."','".date("y-m-d H:i:s", time())."','".$_SERVER['REMOTE_ADDR']."')");
echo "<center><font color=white>Account successfully registered!</font></center>";
}
else
{
echo "<center><font color=white>This account has been registered, please select another!</font></center>";
}
}
}
else
{
echo "<center><font color=white>Password authentication is not the same as your Password</font></center>";
}
}
}
?>
<body background=http://localhost/black/img/bg.png>
|
config.php:
Quote:
<?php
require_once './inc/class.captcha.php';
// Configurations
$myhost="localhost";
$mypass="test"; //your server login password
$myuser="root"; //your server login username
$mydbacc="account"; //your server account database
$mydbdata="my"; //your server my database name
$serveraddress="5.66.**,***"; //your server ip
$serverport=3306; //your server connection port
$mydb="my"; //your server my database
$servername = "BlackThunder Online"; //Put your servername here.
$link = "http://5.66.**.***"; //Put your website link here
// Dont Edit after this
mysql_connect($myhost,$myuser,$mypass);
mysql_select_db($mydb);
?>
|
|
|
|
08/31/2011, 16:23
|
#13
|
elite*gold: 0
Join Date: Sep 2010
Posts: 134
Received Thanks: 105
|
as i stated above. 3306 CANNOT be used. Its the MySQL Port. Change it to 5816 [Which is the Server Port] and try again.
this below is the config u just gave us, the red is the error or stuff u forgot to add.
Quote:
<?php
require_once './inc/class.captcha.php';
// Configurations
$myhost="localhost";
$mypass="test"; //your server login password
$myuser="root"; //your server login username
$mydbacc="account"; //your server account database
$mydbdata="my"; //your server my database name
$serveraddress="5.66.**,***"; //your server ip
$serverport="5816"; //your server connection port the " are needed also.
$mydb="my"; //your server my database
$servername = "BlackThunder Online"; //Put your servername here.
$link = "http://5.66.**.***"; //Put your website link here
// Dont Edit after this
mysql_connect($myhost,$myuser,$mypass);
mysql_select_db($mydb);
?>
|
|
|
|
08/31/2011, 16:45
|
#14
|
elite*gold: 246
Join Date: Jan 2008
Posts: 1,712
Received Thanks: 896
|
San-Goku: You now have a different config.php than before. Which one is the real one?
Also, instead of using 'localhost' just use '127.0.0.1' and see if that helps if you aren't mix-matching different php files.
xTwiztedKidx:
PHP Code:
define('host', 'localhost'); // Your database host
define('user', 'root'); // Your database username
define('pass', 'test'); // Your database password
@mysql_connect($myhost, $myuser, $mypass) or die('<h1>Unable to connect to database server.</h1>');
host != $myhost
EDIT: Any problems with the server port should be inconsequential at the moment anyway since you can't even see the site yet. You can wait to fix those as your script is failing to connect to mysql.
|
|
|
08/31/2011, 16:48
|
#15
|
elite*gold: 0
Join Date: Sep 2010
Posts: 134
Received Thanks: 105
|
Yes, King_Arthur I do agree, Its even different from the one I suggested. I also noticed he is using Port 3306 which is MySql, And you need to use 5816. Which is the server port. And he don't have the quotations around the port number which will also throw an error.
The reason the site is failing to connect can be because of the Port. But, I could be wrong. It can also be other reasons beyond that.
EDIT: Nevermind I believe you are right on the port thing King_Arthur. Sorry for the confusion. Try the localhost trick that King_Arthur stated above.
|
|
|
 |
|
Similar Threads
|
Mysql error & Keine Connection von aussen (belohnung)
01/30/2011 - WoW Private Server - 4 Replies
Hi,
seit 2 tagen versuche ich die mysql richtig zum laufen zu bekommen,
mein server existiert ja man kann auch schon drauf spielen,
jedoch kann ich keine regi page online stellen auf einem webspace es kommt immer keine verbindung zur datenbank.
oder wenn ich ausserhalb via navicat connecten will cant get hostname for ur adress.
Wie kann ich die mysql so einstellen das sie von ausserhalb erreich bar ist habe schon alle dinge versucht benutzer@% etc.
wer kann mir bei diesem problem...
|
[ERROR] Mysql can't connect to local Mysql server through socket
11/06/2010 - Metin2 Private Server - 5 Replies
I just recently tried to configure a DNS server for MT2.. It came up with this error
ERROR: 2002 (HY000): Can't connect to local Mysql server through socket '/tmp/mysql.sock' (2)
Do I need to do a fresh installation of FBSD?
:S
Thanks.
|
ERROR: Connection failed. Host 'Mcncc.com' is blocked because of many connection erro
04/10/2010 - Metin2 Private Server - 8 Replies
Hab ein Problem mit meinem DynDns Server nach einiger Zeit kommt bei der DB und Regi immer olgendes "ERROR: Connection failed. Host 'Mcncc.com' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'" kann mir jemand sagen woran das liegt?
|
Error MySQL Connection and New Database
11/24/2008 - CO2 Private Server - 8 Replies
My first problem: I'm trying to remake another server using LOTF this time, but now when I try to open up the localhost connection in MySQL I get this error: 2003 - Can't connect to MySQL server on 'localhost' (10016). I remember this error happened to me before as well, but I forget what exactly I did to fix it because it was working later on. If I can't open the connection then I can't make a new database.
My second problem: When I go here "http://localhost/phpmyadmin"
The page cannot be...
|
All times are GMT +1. The time now is 06:41.
|
|