我确实阅读了本教程
https://developers.google.com/appengine/docs/php/cloud-sql/
我创建了一个具有名称的实例,schoolnbd
我的项目 ID 是myapplication-2013
阅读教程后我尝试了下面的代码
<?php
$dhost=":/cloudsql/myapplication-2013:schoolnbd";
$duser="root";
$dpassword="xxxyyy";
$database="schoolnbd";
$connection=mysql_connect($dhost, $duser, $dpassword) or die("Could not Connect to SQL Server Suleman");
$db=mysql_select_db($database, $connection) or die(" Check the Database Name from Config.php , wrong database entered ");
?>
但它显示“无法连接到 SQL Server Suleman”。我已经按名称创建了一个用户suleman
并进行了一些更改,但它仍然没有连接到 SQL 服务器,我看到了相同的消息。我试过做很多改变,比如
试试 1
$dhost=":/cloudsql/myapplication-2013:schoolnbd";
$duser="suleman";
试试 2
$dhost="localhost";
$duser="root";
试试 3
$dhost=":/myapplication-2013:schoolnbd";
$duser="root";
试试 4
$dhost=":/cloudsql/myapplication-2013:myapplication-2013:schoolnbd";
$duser="root";
试试 5
$dhost=":/cloudsql/myapplication-2013:myapplication-2013:schoolnbd";
$duser="suleman";
错误日志中的错误是
it is Showing mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES) in /base/data/home/apps/s~myapplication-2013/1.371632998623546850/test.php on line 6
当我使用
$dhost=":/cloudsql/myapplication-2013:schoolnbd";
$duser="root";