在Windows 7上的Google App Engine PHP SDK中配置MySQL连接 [英] Configuring MySQL connection in Google App Engine PHP SDK on Windows 7

查看:154
本文介绍了在Windows 7上的Google App Engine PHP SDK中配置MySQL连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要在Windows 7系统上配置 Google App Engine SDK以使用本地安装的MySQL的基本帮助。 GAE安装是香草(GAE 1.8.8,Python 2.7.6,PHP 5.4),同时安装了MySQL 5.6.15。我能够使用MySQL控制台,所以MySQL正在运行。 PHP也在运行。



当我运行一个几乎完全由这一行组成的短PHP脚本时:

  $ dbconn = mysql_connect('localhost','root','rootpwd'); 

这是我得到的错误信息:

 警告:mysql_connect():由于目标计算机主动拒绝它,因此无法建立连接。 

我的问题:我需要添加或更改哪些设置才能允许我的PHP脚本连接到MySQL?

我的root用户名和密码是正确的,正如我通过控制台访问MySQL的能力所验证的。 GAE SDK设置和WAMP服务器之间有一些区别,我也安装在同一台机器上,但现在没有运行。新安装的MySQL实例和WAMP服务器之间是否仍然可能存在冲突?我需要设置一些环境变量(在Windows中,在SDK中或其他地方)吗?



我相当肯定这个问题以前曾被问到过,但我所看到的答案要么比我认为必要的更复杂,要么仅仅是配置连接的细节。任何帮助将不胜感激。






FIGURED IT OUT ...显然,我的脚本被指向来自WAMP服务器,当我尝试在脚本中连接时未运行。只要我开始使用MySQL实例,脚本连接到它。



因此,故事的道理是......如果您已经安装了MySQL实例GAE SDK,只要该服务运行您的GAE PHP脚本就可以找到它,并且不需要为Google SDK安装另一个MySQL实例。

解决方案

您必须允许外部连接。



我不知道路径,但显然,GAE并非直接连接到本地主机。



您可以将localhost更改为127.0.0.1以测试它,或更改为:: 1。

有些链接尝试更改MySql外部连接规则。



http://www.thegeekstuff.com/2010/08/allow-mysql-client-connection/



如何允许远程连接到mysql


Need basic help configuring Google App Engine SDK on a Windows 7 system to use a local install of MySQL. The GAE install is vanilla (GAE 1.8.8, Python 2.7.6, PHP 5.4), with MySQL 5.6.15 also installed. I am able to use the MySQL console, so MySQL is running. PHP is also running.

When I run a short PHP script consisting almost entirely of this line:

$dbconn = mysql_connect('localhost','root','rootpwd');

this is the error message I get:

Warning: mysql_connect(): No connection could be made because the target machine actively refused it.

My question: What settings do I need to add or change to allow my PHP scripts to connect to MySQL?

My root username and password are correct, as verified by my ability to access MySQL through the console. There are some difference between the GAE SDK setup and that of a WAMP server, which I also have installed on the same machine but which is not running now. Is there still likely to be a conflict between the freshly installed MySQL instance and the one on the WAMP server? Are there some environment variables (in Windows, in the SDK, or elsewhere) that I need to set?

I'm fairly sure this question has been asked before, but the answers I am seeing are either more complex than I can believe would be necessary, or simply gloss over the details of configuring the connection. Any help would be appreciated.


FIGURED IT OUT... Apparently my script was being pointed to the MySQL instance from the WAMP server, which was not running when I tried to connect in the script. As soon as I started that MySQL instance, the script connected to it.

So the moral of the story is... if you already have a MySQL instance installed outside of the GAE SDK, as long as that service is running your GAE PHP script will find it, and there's no need to install another MySQL instance just for the Google SDK.

解决方案

You must allow external connection.

I don't know the path, but, apparently, the GAE connects to localhost not directly.

You can change the "localhost" by "127.0.0.1" to test it, or to "::1".

Some links to try change MySql external connections rules.

http://www.thegeekstuff.com/2010/08/allow-mysql-client-connection/

How to allow remote connection to mysql

这篇关于在Windows 7上的Google App Engine PHP SDK中配置MySQL连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆