有人可以帮我解决这个问题吗,我写了一个简单的代码来测试MySQL连接,它在本地工作,但在app引擎上部署之后无法连接MySQL。
文件app.yaml:
application: testmysql07
version: 1
runtime: php55
api_version: 1
threadsafe: yes
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: .*
script: main.php
文件main.php:
<?php
$hostname = "localhost";
$username = "root";
$password = "";
$databasename = "web_bb";
$conn = mysql_connect($hostname,$username,$password,$databasename) or die("Can't connect MySQL");
echo "Successful </br>";
mysql_select_db($databasename,$conn);
?>
抱歉我说英语不好
答案 0 :(得分:0)
要在开发期间连接到本地MySQL数据库,您需要
$hostname
。