Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

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());

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. 

Is there anything else I have to do that I am not aware of or should it work?

1 Answer

0 votes
by (44.4k points)
  • Give authorized access to your database by providing proper account credentials
  • Check out this documentation Getting Started with Amazon RDS and set up your RDS instance properly
  • Use the actual IP address provided by the rds instance

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...