使用PHP连接到Amazon RDS [英] Connect to Amazon RDS with PHP
本文介绍了使用PHP连接到Amazon RDS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将RDS实例与PHP连接文件连接起来.
I am trying to connect my RDS Instance with my PHP connection file.
这就是我的文件中的内容:
This is what I have in my file:
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'User Name');
define('DB_PASSWORD', 'Password');
define('DB_DATABASE', 'DATABASE');
$connection = mysql_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD) or die(mysql_error());
$database = mysql_select_db(DB_DATABASE) or die(mysql_error());
我用我的RDS实例用户用端点(rds东西)url,用户名和密码替换了localhost,并使用了创建实例时设置的pass和数据库名称.但这似乎不起作用.
I replaced localhost with my endpoint (rds thing) url, username and password with my RDS Instance user and pass and database name the one I've set when I created the instance. But it doesn't seem to work.
还有其他我不知道的事情还是应该起作用?
推荐答案
一些想法:
- 尝试使用实例的实际IP,它应该可以工作.
- 您是否已授权访问数据库实例?
- 您可能想看看 Amazon RDS入门正确设置您的RDS实例
- Try using the actual IP of the instance, then it should work.
- Did you authorized access to your DB instance?
- You may want to have a look at Get Started with Amazon RDS to properly setup your RDS instance
这篇关于使用PHP连接到Amazon RDS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文