Installation, Configuration, & Upgrades  :: 
Possible Error in the New PN 0.75 Gold PHP MySQL code?
 Top

  • My Background With PN: I have installed several versions of PN, with the same DB name and the same DB user. This is the only version I have gotten this message. Each install was a new install - I like to start fresh - and restore my DB in stages. :) No PWs or DB names / access was changed from the last install. I am a SQL/VBS/VB/C# guy. I am no PHP programmer by any means, but I get by.


    Problem:
    ------------------------------------------------------------------------------------

    Quote


    No database made.
    Warning: mysql_connect(): Access denied for user: 'fubar_admin@localhost' (Using password: YES) in /nfs/home/fubar/public_html/pnadodb/drivers/adodb-mysql.inc.php on line 320
    Error connecting to DB
    Program: /nfs/home/fubar/public_html/install/db.php - Line N.: 45
    Database: PostNuke
    Error (1045) : Access denied for user: 'fubar_admin@localhost' (Using password: YES)



    Info - Excerpt from my web hosts cPanel X - MySQL Account Maintenance:
    ------------------------------------------------------------------------------------
    Databases: fubar_postnuke
    Users in PostNuke
    fubar_cmsadmin (Privileges: ALL PRIVILEGES)

    Connection Strings
    PHP $dbh=mysql_connect ("localhost", "fubar_admin", "<password here="here">") or die ('I cannot connect to the database because: ' . mysql_error());
    mysql_select_db ("fubar_postnuke");</password>

    ------------------------------------------------------------------------------------

    Resolve thus far:
    I have read the FAQ and other messages covering topics close to this problem, but nothing explains what to do NEXT, if all if correct and all worked before and with other older code. Can anyone help?

    Update / My Fix:
    I looked at the db.php and on line 45 and such, I hard coded the variables and it worked. So it seems a variable is losing its contents somewhere from 60% - this point. The function reads:
    ------------------------------------------------------------------------------------
    Orignal Code
    ------------------------------------------------------------------------------------

    Code

    function dbconnect($dbhost, $dbuname, $dbpass, $dbname, $dbtype = 'mysql')
    {
        $connectString = "$dbtype://$dbuname:$dbpass@$dbhost/$dbname";

        global $ADODB_FETCH_MODE;
        $dbconn = &ADONewConnection($dbtype);
        $dbh = $dbconn->Connect($dbhost, $dbuname, $dbpass, $dbname);
        $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
        // if we get an error, log it and die
        if ($dbh === false) {
            error_log ("connect string: $connectString");
            error_log ("error: " . $dbconn->ErrorMsg());
            // show error and die
            PN_DBMsgError($dbconn, __file__ , __line__, "Error connecting to db");
        } else {
            return $dbconn;
        }
    }


    ------------------------------------------------------------------------------------
    Changed Code
    ------------------------------------------------------------------------------------

    Code

    function dbconnect($dbhost, $dbuname, $dbpass, $dbname, $dbtype)
    {
        $dbtype = "mysql";
        $dbhost = "localhost";
        $dbuname = "fubar_admin";
        $dbpass = "password";
        $dbname =  "fubar_admin";
        $connectString = "$dbtype://$dbuname:$dbpass@$dbhost/$dbname";

        global $ADODB_FETCH_MODE;
        $dbconn = &ADONewConnection($dbtype);
        $dbh = mysql_connect ($dbhost, $dbuname, $dbpass, $dbname);
        $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
        // If we Get an error, log it AND die
        if ($dbh === false) {
            error_log ("connect string: $connectString");
            error_log ("error: " . $dbconn->ErrorMsg());
            // show error AND die
            PN_DBMsgError($dbconn, __file__ , __line__, "Error connecting to db");
        } else {
            return $dbconn;
        }
    }
  • That error you got means something was entered wrong. No two ways about it. I've done 3 installs of 750RC2 and had no problems.
  • nit sure about it - but

    Quote

    Users in PostNuke
    fubar_cmsadmin (Privileges: ALL PRIVILEGES)

    Quote

    Error (1045) : Access denied for user: 'fubar_admin@localhost' (Using password: YES)

    seems to be a mismatch in the username...

    --
    regards from germany
    ..::[Zikula Application Framework]::.. ..::[SEO-Blog]::.. ..::[CMS Sicherheit]::..
  • larsneo

    nit sure about it - but

    Quote

    Users in PostNuke
    fubar_cmsadmin (Privileges: ALL PRIVILEGES)

    Quote

    Error (1045) : Access denied for user: 'fubar_admin@localhost' (Using password: YES)

    seems to be a mismatch in the username...


    Nope, there's not. I just forgot one in my post edit. Didn't want my real names in the post :)
This list is based on the users active over the last 60 minutes.