Error with $conn = mysql_connect(":/cloudsql/...

332 views
Skip to first unread message

Hans Simtanda Caspersen

unread,
Oct 6, 2013, 11:22:41 PM10/6/13
to google-cloud...@googlegroups.com
Hi, 

im working at http://abcategories-com.appspot.com/ and i am ALSO using this script: 

<?php $conn = mysql_connect(":/cloudsql/abcategories-com:authorbooksdatabase", "username", "password"); ?> 

...to connect to my Cloud SQL, but i am getting no reaction online! 

And on my local web server (PHP SDK) i am getting the following error: 

Warning: mysql_connect(): No connection could be made because the target machine actively refused it. in C:\Google APP Sites\ABCategories\helloworld.php on line 21

Razvan Musaloiu-E.

unread,
Oct 6, 2013, 11:47:32 PM10/6/13
to google-cloud...@googlegroups.com
The '/cloudsql/...' only works on app server (and not dev app server). What error do you see in the appengine logs for your application?

-- Razvan ME


--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/1962436c-80e3-4043-9a85-200694833f40%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hans Simtanda Caspersen

unread,
Oct 7, 2013, 12:02:20 AM10/7/13
to google-cloud...@googlegroups.com
I have attached a log and it seems that there is no error or what?


On Monday, October 7, 2013 5:47:32 AM UTC+2, Razvan Musaloiu-E. wrote:
The '/cloudsql/...' only works on app server (and not dev app server). What error do you see in the appengine logs for your application?

-- Razvan ME
On Sun, Oct 6, 2013 at 8:22 PM, Hans Simtanda Caspersen <ad...@simtanda.com> wrote:
Hi, 

im working at http://abcategories-com.appspot.com/ and i am ALSO using this script: 

<?php $conn = mysql_connect(":/cloudsql/abcategories-com:authorbooksdatabase", "username", "password"); ?> 

...to connect to my Cloud SQL, but i am getting no reaction online! 

And on my local web server (PHP SDK) i am getting the following error: 

Warning: mysql_connect(): No connection could be made because the target machine actively refused it. in C:\Google APP Sites\ABCategories\helloworld.php on line 21

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsub...@googlegroups.com.
log.jpg

Razvan Musaloiu-E.

unread,
Oct 7, 2013, 12:11:07 AM10/7/13
to google-cloud...@googlegroups.com
What does mysql_error() says?

-- Razvan ME


To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/5114b26f-f5c5-4949-bf24-19e04f6cc2e1%40googlegroups.com.

Hans Simtanda Caspersen

unread,
Oct 7, 2013, 12:20:53 AM10/7/13
to google-cloud...@googlegroups.com
I have attached another log file form mysql prompt and there is no errors regarding connect


On Monday, October 7, 2013 6:11:07 AM UTC+2, Razvan Musaloiu-E. wrote:
What does mysql_error() says?

-- Razvan ME
On Sun, Oct 6, 2013 at 9:02 PM, Hans Simtanda Caspersen <ad...@simtanda.com> wrote:
I have attached a log and it seems that there is no error or what?


On Monday, October 7, 2013 5:47:32 AM UTC+2, Razvan Musaloiu-E. wrote:
The '/cloudsql/...' only works on app server (and not dev app server). What error do you see in the appengine logs for your application?

-- Razvan ME
On Sun, Oct 6, 2013 at 8:22 PM, Hans Simtanda Caspersen <ad...@simtanda.com> wrote:
Hi, 

im working at http://abcategories-com.appspot.com/ and i am ALSO using this script: 

<?php $conn = mysql_connect(":/cloudsql/abcategories-com:authorbooksdatabase", "username", "password"); ?> 

...to connect to my Cloud SQL, but i am getting no reaction online! 

And on my local web server (PHP SDK) i am getting the following error: 

Warning: mysql_connect(): No connection could be made because the target machine actively refused it. in C:\Google APP Sites\ABCategories\helloworld.php on line 21

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscr...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsub...@googlegroups.com.
log.jpg

Razvan Musaloiu-E.

unread,
Oct 7, 2013, 12:54:45 AM10/7/13
to google-cloud...@googlegroups.com
mysql_error() is a PHP function you can call after mysql_connect [1]. Do you mind showing us the code you use to connect?



To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/08dffffd-20db-4ec4-8a0c-fc9921ddeb54%40googlegroups.com.

Hans Simtanda Caspersen

unread,
Oct 7, 2013, 12:59:45 AM10/7/13
to google-cloud...@googlegroups.com
<?php 
 // Connects to your Database 
 mysql_connect(":/cloudsql/abcategories-com:authorbooksdatabase", "username", "password") or die(mysql_error()); 
 mysql_select_db("abc") or die(mysql_error()); 
 ?> 

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsub...@googlegroups.com.

Hans Simtanda Caspersen

unread,
Oct 7, 2013, 1:01:00 AM10/7/13
to google-cloud...@googlegroups.com
And the error is: Access denied for user 'ad...@simtanda.com'@'localhost' (using password: YES)

Razvan Musaloiu-E.

unread,
Oct 7, 2013, 1:02:25 AM10/7/13
to google-cloud...@googlegroups.com
Can you try the username "root" without any password?

-- Razvan ME


To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/81dea7e9-ff1c-4fc0-9a10-91fbcbbb8a07%40googlegroups.com.

Hans Simtanda Caspersen

unread,
Oct 7, 2013, 1:06:08 AM10/7/13
to google-cloud...@googlegroups.com
Done, http://abcategories-com.appspot.com/ is now not showing errors

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsub...@googlegroups.com.

Hans Simtanda Caspersen

unread,
Oct 7, 2013, 1:09:41 AM10/7/13
to google-cloud...@googlegroups.com
so what does it mean

Joe Faith

unread,
Oct 7, 2013, 11:07:54 AM10/7/13
to google-cloud...@googlegroups.com
Hi Hans

the documentation on setting instance-level access control should help:

Also see the MySQL documentation on managing MySQL users:

j


To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/d58add61-2cac-4fad-a628-67d33c6fc6f7%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.



--
Joe Faith | Product Manager | Google Cloud

Hans Simtanda Caspersen

unread,
Oct 7, 2013, 11:33:37 AM10/7/13
to google-cloud...@googlegroups.com
thanks

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsub...@googlegroups.com.

Sandip Mavani

unread,
Nov 15, 2018, 11:07:03 AM11/15/18
to Google Cloud SQL discuss
same issue but i have different error.

$connstr = ':/cloudsql/instancename';
$link = mysql_connect($connstr,'useraname','password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';

No such file or directory

but same working in pdo

and this is necessary to user mysql_connect.

Dan (Cloud Platform Support)

unread,
Nov 19, 2018, 5:18:19 PM11/19/18
to Google Cloud SQL discuss
Hello,

I believe that your questions should get a better assistance in the Stack Overflow[1] since it is related to a technical issue. There, you should receive help from the community fellow enthusiasts, and from Google engineers when you add a tag in your post according to the product where you require assistance, as you can check in our documentation[2]. Additionally, you can post some details regarding your setup, project config, and some code samples.

Reply all
Reply to author
Forward
0 new messages