Home Codeanywhere and Phpmyadmin database connection
Reply: 0

Codeanywhere and Phpmyadmin database connection

user7670
1#
user7670 Published in September 19, 2018, 9:08 am

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.

share|improve this question
  • Did you double check the connection parameters? – Arun Apr 17 at 5:47
  • Codeanywhere is an editor (as per my understanding). So the connection problem is not with codeanywhere. The problem you are facing is with your web server and database. Am I right ? – smilyface Apr 17 at 5:51
  • Yes I believe there is a connection problem with phpmyadmin and localhost. – Aaron Willey Apr 17 at 18:13

1 Answer 1

active oldest votes
up vote 0 down vote
You need to login account before you can post.

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

© 2016 Powered by mzan.com design MATCHINFO