ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Scripts  >>  PHP
 
 


 

 
 PHP interview questions  PHP Interview Questions
 ASP interview questions  ASP Interview Questions
 CGI Perl interview questions  CGI Perl Interview Questions
 JavaScript interview questions  JavaScript Interview Questions
 VB Script interview questions  VB Script Interview Questions
 JSP interview questions  JSP Interview Questions
 Shell Script interview questions  Shell Script Interview Questions
 Python interview questions  Python Interview Questions
 Tcl interview questions  Tcl Interview Questions
 Awk interview questions  Awk Interview Questions
 AJAX interview questions  AJAX Interview Questions
 Ruby on Rails interview questions  Ruby on Rails Interview Questions
 Scripts AllOther interview questions  Scripts AllOther Interview Questions
Question
i got this error msg in online... how to solve this
problem... i couldnot find out as soon as possible send me
answer or idea


COULD NOT ABLE TO CONNECT DATABASE .
Can't connect to local MySQL server through socket
'/usr/local/mysql-5.0/data/mysql.sock' (2)
 Question Submitted By :: Prabhu
I also faced this Question!!     Rank Answer Posted By  
 
  Re: i got this error msg in online... how to solve this problem... i couldnot find out as soon as possible send me answer or idea COULD NOT ABLE TO CONNECT DATABASE . Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2)
Answer
# 1
database connection was not established yet that's why this 
error is occuring.

$con=mysql_connect("localhost","root","password") or die
(mysql_error());
$link=mysql_select_db('test',$con);
if(!$link)
{
	die(mysql_error());
}
"root" is the user name
"test" is the database name
 
Is This Answer Correct ?    4 Yes 0 No
Asheesh
 
  Re: i got this error msg in online... how to solve this problem... i couldnot find out as soon as possible send me answer or idea COULD NOT ABLE TO CONNECT DATABASE . Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2)
Answer
# 2
First you have to make a database connection. coding is below mention:
first u have to create a connection to server like:
mysql_connect("localhost","root","");

then select the database like:
mysql_select_db("database_name");

localhost is default server name.
root is default user name.
"" is default password. it means password is blank.
 
Is This Answer Correct ?    1 Yes 1 No
Ritu
 
 
 
  Re: i got this error msg in online... how to solve this problem... i couldnot find out as soon as possible send me answer or idea COULD NOT ABLE TO CONNECT DATABASE . Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2)
Answer
# 3
database name must be wrong or you can use IP address 
instead of 'localhost'.
 
Is This Answer Correct ?    0 Yes 0 No
Shweta
 

 
 
 
Other PHP Interview Questions
 
  Question Asked @ Answers
 
What are the different types of Errors in PHP? Troop-Software6
What are the different methods of passing data or information between two calls of a web page? What are the advantages/disadvantages of these methods? Patni2
What are the Merits and De-Merits of CURL library ?  1
What is MIME?  1
How can I execute a PHP script using command line? Sify2
Who is the father of PHP and explain the changes in PHP versions? Rushmore-Consultancy1
If i make my selection in State Dropdown list, i would the City and ZipCode dropdown list to be automatically reupdated based on the State i select.(This to avoid the user select a City or Zipcode that does not correspond to the State previously selected.) CMC1
How to add different images in php program like a job site.......  2
Why using the htaccess file  2
How can we submit a form without a submit buttom? A1-Technology10
what are in image creating functions in php A1-Technology4
hello myself Atul saini completed mca in 2007 due to personal problem i cant do job.now i really search 4 a job.i dont know where i go i think simple think is learn php anyone help me wat i can do for a job. thanks  1
What and How possible injection in PHP and mysql? RedAlkemi1
How to download the files using PHP  1
Suppose your Zend engine supports the mode <? ?> Then how can u configure your PHP Zend engine to support <?PHP ?> mode ?  4
When you will get the error "Cannot add header information"?  2
List out some tools through which we can draw E-R diagrams for mysql?  4
what do you mean by webserver's document root?  2
write function of the sentence traversal passing the parameter, e.g input:this is input sentence. output:sentence input is this. HyperQuality1
How to upload a file (may be a .txt or a .doc file) from a php script/file?  1
 
For more PHP Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com