1. Home >
  2. Apps >
  3. Groups >

Unable to connect to database

Question asked by Manish Goyal in #Databases on Mar 12, 2010
Manish Goyal
Manish Goyal · Mar 12, 2010
Member of CrazyEngineers
I have to update a website but i am unable to connect to Mysql server when i try to connect it gives me exception like this

Could not connect: Can't connect to MySQL server on 'localhost' (10061)PHP Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'localhost' (10061) in D:\Domains\techno-opus2009.co.in\wwwroot\Register.php on line 5

I am using following php script
<?php
$con = mysql_connect("localhost","manish","***");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

// Create database
if (mysql_query("CREATE DATABASE alu",$con))
  {
  echo "Database created";
  }
else
  {
  echo "Error creating database: " . mysql_error();
  }

// Create table
mysql_select_db("alumini", $con);
$sql = "CREATE TABLE d
(
Rollno BIGINT NOTNULL AUTO_INCREMENT,PRIMARY KEY(Rollno),
Name varchar(25),
course varchar(25),
batch int,
address varchar(150),
state varchar(25),
country varchar(25),
Phoneno BIGINT,
Mobileno BIGINT,
Email_Id varchar(30),
Mychoice varchar(25),
PresentOrganization varchar(25),
PresentPosition varchar(25),
OfficeAddress varchar(150),
Married varchar(25),
Mchoice varchar(25)
)";

// Execute query
mysql_query($sql,$con);

mysql_close($con);
?> 
Please help me ..It is urgent Posted in: #Databases
Manish Goyal
Manish Goyal · Mar 12, 2010
Member of CrazyEngineers
Guys please help me I really need it
Is there any one here who ever hosts his website and use mysql?
thechamp
thechamp · Mar 12, 2010
Member of CrazyEngineers
make sure you have entered password in webpage same as that saved in your mysql.
Manish Goyal
Manish Goyal · Mar 12, 2010
Member of CrazyEngineers
yes I have checked that also..but no good response 😔
thechamp
thechamp · Mar 12, 2010
Member of CrazyEngineers
the link you provided for MySql connection seems broken.
Manish Goyal
Manish Goyal · Mar 12, 2010
Member of CrazyEngineers
you mean this link
D:\Domains\techno-opus2009.co.in\wwwroot\Register.php
If yes ,I have not given this link anywhere it is just coming in the exception
thechamp
thechamp · Mar 12, 2010
Member of CrazyEngineers
try uploading website another time.. might be server problem that time.
or it could be related to port i guess. i searched on net, it says could be related to your firewall too.i think googling should do it,as i dont think problem is in coding.
Manish Goyal
Manish Goyal · Mar 12, 2010
Member of CrazyEngineers
Thanks champ
Waiting for more replies ..can anyone help me here ?

You must log-in or sign-up to reply to this post.

Click to Log-In or Sign-Up