Home Codeanywhere and Phpmyadmin database connection
Reply: 0

Codeanywhere and Phpmyadmin database connection

user1347
1#
user1347 Published in April 20, 2018, 6:03 pm

I am having a difficult time connection my codeanywhere to my phpmyadmin database. I am receiving this error:

"SQLSTATE[HY000] [1045] Access denied for user '//username'@'localhost' (using password: YES)"

and my database connection looks like:

  <?php
     class Database {
private static  $dbName = '//database name here' ;
private static $dbHost = 'localhost' ;
private static $dbUsername = '//username here';
    private static $dbUserPassword = '//password here';

    private static $cont  = null;

    public function __construct() {
        die('Init function is not allowed');
    }

    public static function connect()
    {
       // One connection through whole application
       if ( null == self::$cont )
       {     
        try
        {
          self::$cont =  new PDO( "mysql:host=".self::$dbHost.";"."dbname=".self::$dbName, self::$dbUsername, self::$dbUserPassword); 
        }
        catch(PDOException $e)
        {
          die($e->getMessage()); 
        }
       }
       return self::$cont;
    }

    public static function disconnect()
    {
        self::$cont = null;
    }
}
?>

I am wondering if there is a problem with my localhost and codeanywhere or if I simply inputted phpmyadmin wrong. Thank you.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.304676 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO