Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    connect to mysql

    i have this code:
    Code:
    <?php 
    $conn = mysql_connect("localhost", "root", "elephant"); 
    echo "$conn"; 
    ?>
    and this is the output:
    Warning: MySQL Connection Failed: Client does not support authentication protocol requested by server; consider upgrading MySQL client in c:\program files\apache group\apache\htdocs\test\index.php on line 9

    and this code:
    Code:
    <?php 
    	$conn = mysql_connect(); 
    	echo "$conn"; 
    ?>
    i have this output:
    Resource id #1

    what does it mean?

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,266
    Thanks
    6
    Thanked 48 Times in 48 Posts
    You can't echo out a connection. Usually your mysql connection doesn't have a password either if it's on your pc.
    PHP Code:
    <?php
    $link 
    mysql_connect("localhost","root","") or die(mysql_error());
    mysql_select_db("databasename",$link) or die(mysql_error());
    ?>
    That's what you should have to start off with

  • #3
    Regular Coder
    Join Date
    Nov 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts
    when i do it in dos prompt everything is ok, i have a user named: root with password: elephant.
    what is the problem pliz.

  • #4
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,266
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Another thing, what mysql version are you using? You should be using mysql 3.*

  • #5
    Regular Coder
    Join Date
    Nov 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts
    it is ver 5.0.0-alpha

  • #6
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,266
    Thanks
    6
    Thanked 48 Times in 48 Posts
    I don't think php supports that version yet. Think it only supports version 3.*

  • #7
    Regular Coder
    Join Date
    Nov 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanxxxxxxxxx


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •