You can do this using AWS RDS
Follow these steps
- Search for RDS in console, Select MySQL engine, enter the details (DB name, User, Password) and keep the rest categories as default.
- Mention retention period of 1-7 days, and launch the instance.
- After launching change the inbound security to "Any where".
- Copy the endpoint url and port number.
- Install wamp server 64 and mention its path in command prompt.
- To connect to your database enter the following credentials- endpoint, port, user name and password: To connect to your database enter the following credentials- endpoint, port, user name and password
- To see all the databases available enter following command: show databases;(you can run all your SQL Commands)
- Go to wamp64 and create a folder www.directory, Install AWS SDK for PHP ( https://amzn.to/2LNUuxd ) and visual studio code
- create program file in Visual Studio-
- mention these configuration lines in your php code
$servername = "mydbinstance.cg0pjwazvghg.us-west-1.rds.amazonaws.com";
$username = "admin";
$password = "edureka123";
$dbname = "edureka24db";
$fname = $_POST['firstname'];
// Create connection
$conn=mysqli_connect($servername,$username, $password) OR DIE ('Unable to connect to database! Please try again later.');
echo "<p>Connected to MySQL!</p>";
echo "<p>Connected to DB!</p>";
// Check connection
$sql = "INSERT INTO ".$usertable." values('".$fname."','".$lname."');";
- To debug the code click on “Start Debugging”