FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Connecting to MySQL server....
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Connecting to MySQL server.... [message #181064 is a reply to message #181049] Mon, 08 April 2013 02:14 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 4/7/2013 11:04 AM, The Natural Philosopher wrote:
> On 07/04/13 14:09, M. Strobel wrote:
>> Am 07.04.2013 14:32, schrieb Jerry Stuckle:
>>> On 4/7/2013 4:45 AM, M. Strobel wrote:
>>>> Am 07.04.2013 05:23, schrieb nag:
>>>> > Hi,
>>>> >
>>>> > I have debconnect.php like the following...
>>>> >
>>>> >
>>>> > <?php
>>>> >
>>>> > $con=mysql_connect("localhost","root","") ;
>>>> >
>>>> > if(!$con){
>>>> > die('Error in Connection: '. mysql_error());
>>>> > }
>>>> > mysql_select_db('newdb',$con);
>>>> >
>>>> > ?>
>>>> >
>>>> > If I give the password or user name wrong it is flashing the
>>>> > error, but if the
>>>> > database name wrong it is simply displaying a blank php file. How
>>>> > can I change the
>>>> > above to show the error even if the wrong database name is given.
>>>> >
>>>> > Thank you.
>>>> >
>>>> >
>>>> >
>>>> >
>>>> Two more observations:
>>>>
>>>> - you are using the deprecated mysql API, use mysqli or PDO instead.
>>>> - if the db server is local, it is a lot faster to connect to a path
>>>> pointing to a
>>>> local socket
>>>>
>>>> /Str.
>>>>
>>>
>>> "localhost" DOES use a socket (Linux) or named pipe (Windows).
>>
>> I am talking about the difference between AF_UNIX and AF_INET, on
>> Linux - is this new
>> that "localhost" does not start an IP connection? Can't check now,
>> don't have a test DB.
>>
>
> last time I checked it was in fact wrong*: localhost seeems to use
> 127.0.0.1 not a unix pipe
>
> I know this because whilst I could use the mysql client on a particular
> database, php didn't work with it until I granted IP access on interface
> 127.0.0.1 as well.
>
> *But its Jerry, so this is 'normal behaviour'
>
>
>> /Str.
>>
>
>

Then you had something screwed up in your installation. But then that's
nothing new. You ALWAYS have something screwed up.

You were probably trying to connect to Oracle instead of MySQL, and
don't know the difference.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: comparing arrays
Next Topic: PHP with MS SQL SERVER: is it suitable?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 23:22:36 GMT 2024

Total time taken to generate the page: 0.06208 seconds