Results 1 to 4 of 4

Thread: mysql connect

  1. #1
    Join Date
    Feb 2009
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default mysql connect

    I have this code:
    $link = mysql_connect('localhost', 'TV', 'functiontest')or die('Error connecting to mysql');
    mysql_select_db("TV",$link);

    I connect with mysql editor is ok
    but when i connect by this code it said that:

    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'TV'@'localhost' (using password: YES) in C:\Program Files\Apache Group\Apache2\htdocs\coppydata\copy.php on line 3
    Error connecting to mysql

  2. #2
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    Quote Originally Posted by manju View Post
    #

    MySQL is a database management system.

    A database is a structured collection of data. It may be anything from a simple shopping list to a picture gallery or the vast amounts of information in a corporate network. To add, access, and process data stored in a computer database, you need a database management system such as MySQL Server. Since computers are very good at handling large amounts of data, database management systems play a central role in computing, as standalone utilities, or as parts of other applications.
    ???

    Fill in the $username and the $password below and run this code:

    PHP Code:
    <?php

    $server 
    'localhost';

    $username '';

    $password '';

    $link mysql_connect($server$username$password);
    if (!
    $link) {
        die(
    'Could not connect: ' mysql_error());
    }
    echo 
    'Connected successfully';
    mysql_close($link);
    ?>
    If this doesn't work, all you can do is make certain you have the right values for $server, $username, and $password. The file you are running is on your C: drive. Are you sure there is a MySQL server with your username on the same machine as the script?

  3. #3
    Join Date
    Feb 2009
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Thank u for your help
    But my database is not store in local, it store on my server.

  4. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    mysql_connect("host", "user", "pass")

    Make sure that your host, user, and password are correct!! (Check in your cpanel for host)
    Jeremy | jfein.net

Bookmarks

Posting Permissions

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