0

I created a database on Google Cloud platform to remove data storage from my server to google to allow moving of the application ext, I created an older version of data and created a PDO connection file in PHP to connect, but it will not.

This issue is related to Google Cloud Storage, not Local mySQL server.

PHP Error : Connection failed: SQLSTATE[HY000] [1045] Access denied for user 'allfree'@'72.XX.33.XX' (using password: YES) 

Using simple root / simple pass to test as SQL user / pass also fails

Google instance name : afc-storage:us-west1:afc

Google Error log : 2019-05-13 14:50:55.200 EDT
2019-05-13T18:50:55.199830Z 101583 [Note] Access denied for user 'allfree'@'72.XX.33.XX' (using password: YES)

Here is my connection code:

$dbhost = "34.83.119.218";
$dbuser = "allfree";
$dbpasswd = "XXXX";
$db_name= "allfreec_afc"; 

 $dsn = 'mysql:dbname='.$db_name.';host='.$dbhost;

try {
    $dbo = new PDO($dsn ,$dbuser, $dbpasswd);
    $dbo->exec("set names utf8");
} catch (PDOException $e) {
    echo 'Connection failed: ' . $e->getMessage();
}

I am only using the database name "allfreec_afc", the instance is not required in the connection from what I keep reading over and over again.

Radium Chris
  • 61
  • 1
  • 8
  • Suggested answered question reffered to a localhost mySql server, that works great the connection to google cloud MySql is the issue here. – Radium Chris May 13 '19 at 19:49
  • You should never use a root account to connect from PDO. Create another user for the purpose. – Your Common Sense May 14 '19 at 06:11
  • I used root just to test connection after tring user avvount, I set user account with IP of server so it errors with the correct username now but still access denied. Very frustrating – Radium Chris May 15 '19 at 12:42
  • I am at my wits end, made a user allfree using IP of my linux server, set password to 1234 and created the connection for PDO. I get the same error, access for user allfree@ip using password:true failed. I get the message on the google console as well so connection is there. User name and password is correct?? I feel like I am missing somthing with the google cloud – Radium Chris May 21 '19 at 19:58

0 Answers0