无法连接到Google云端SQL。使用PHP Google SDK [英] Could not connect to Google cloud SQL. Using PHP Google SDK
问题描述
我没看过这篇教程
https://开发者.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)或死(无法连接到SQL Server Suleman);
$ db = mysql_select_db($ database,$ connection)或死(从Config.php检查数据库名称,输入错误的数据库);
?>
但它显示无法连接到SQL Server Suleman。
我通过名称 suleman
创建了一个用户并进行了一些更改,但仍然没有连接到SQL Server,我看到了同样的消息。
我曾尝试做过很多变化,例如
尝试1
$点雅= :/ CLOUDSQL / MyApplication的-2013:schoolnbd;
$ duser =suleman;
try 2
$点雅= 本地主机;
$ duser =root;
尝试3
$点雅= :/ MyApplication的-2013:schoolnbd;
$ duser =root;
try 4
$点雅= :/ CLOUDSQL / MyApplication的-2013:所有MyApplication-2013:schoolnbd;
$ duser =root;
尝试5
$点雅= :/ CLOUDSQL / MyApplication的-2013:所有MyApplication-2013:schoolnbd;
$ duser =suleman;
错误日志中的错误是
它显示mysql_connect ):第6行的/base/data/home/apps/s~myapplication-2013/1.371632998623546850/test.php中的访问被用户'root'@'localhost'拒绝访问(使用密码:YES)
当我使用时
$ dhost =:/ cloudsql /所有MyApplication-2013:schoolnbd;
$ duser =root;
我也面临同样的问题, ,它就像这样,它很可能会工作
$ dhost =:/ cloudsql / myapplication-2013:schoolnbd;
$ duser =root;
$ dpassword =;
但请记住,如果您设置了root密码,那么您应该更新root密码这在控制台中。
为root设置密码= PASSWORD('');
I did read this tutorial
https://developers.google.com/appengine/docs/php/cloud-sql/
I had created a Instance with name schoolnbd
and my project id is myapplication-2013
After reading the tutorial I tried the code below
<?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 ");
?>
But it is showing "Could not Connect to SQL Server Suleman".
I had created one user by name suleman
and made several changes , but still it is not connecting to SQL server, i am seeing same message.
I had tried doing many changes such as
try 1
$dhost=":/cloudsql/myapplication-2013:schoolnbd";
$duser="suleman";
try 2
$dhost="localhost";
$duser="root";
try 3
$dhost=":/myapplication-2013:schoolnbd";
$duser="root";
try 4
$dhost=":/cloudsql/myapplication-2013:myapplication-2013:schoolnbd";
$duser="root";
try 5
$dhost=":/cloudsql/myapplication-2013:myapplication-2013:schoolnbd";
$duser="suleman";
Error from the error log is
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
when I am using
$dhost=":/cloudsql/myapplication-2013:schoolnbd";
$duser="root";
i also faced the same problem, try without using password, it like this it will most probably work
$dhost=":/cloudsql/myapplication-2013:schoolnbd";
$duser="root";
$dpassword="";
but keep in mind , if you had set your root password then you should update root password, by typing this in console.
SET PASSWORD FOR 'root' = PASSWORD('');
这篇关于无法连接到Google云端SQL。使用PHP Google SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!