SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jan 2011
    Location
    New Delhi, India
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unable to connect to MySQL

    Thanks in advance!
    Is there any one to help me past one weak i am trying continually but the answer is

    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'xxxxxxxxx_xxx'@'xxx.xxx.xx.xxx' (using password: YES) in /home/xxxxxxx/public_html/xxxxxxxxxxxx/submit-dsc.php on line 9
    Unable to connect to MySQL

    but with this same code i could connect in localhost only i will have to change $server option
    on my cpanel i twice a time i dropped and rebuild the database with the same user name password which i am using in local

    the code which i am using

    <?php
    if(count($_POST) > 0)
    {
    // code for database connection string
    $username = "xxxxxxxx_xxxx";
    $password = "xxxxxxxxxxxxxx";
    $server = "xxxxxxxxxxxxxxxx.xxx";

    $dbh=mysql_connect($server,$username,$password)
    or die("Unable to connect to MySQL");
    $selected = mysql_select_db("xxxxxxxxxxx",$dbh)
    or die("Could not select xxxxxxxxxxx");
    Last edited by ydr; Jan 8, 2011 at 06:23. Reason: to add more details

  2. #2
    SitePoint Guru mmarif4u's Avatar
    Join Date
    Dec 2006
    Location
    /dev/swat
    Posts
    619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you sure, you have password for the user for MySQL on server?
    There are some time prefixes used like host123_dbname.
    Also some time not all server support localhost in host variable. You need to ask your host company for that.

  3. #3
    SitePoint Member
    Join Date
    Jan 2011
    Location
    New Delhi, India
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes i have the password for the user for MySQL on server
    Means what you talking about on server C Panel/MySQL Databases right

  4. #4
    SitePoint Member
    Join Date
    Jan 2011
    Location
    New Delhi, India
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear mmarif4u
    Thanks for you cooperation i have solved the problem!
    The problem was i did not allow my external web servers to access my MySQL databases
    thanks once again,
    Dennis.


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
  •