php - Can we create database by code on aws server
Get the solution ↓↓↓In my project, it's required to set up database on run time. I found core PHP have MySQL query to perform this but it's run locally and not on the server.
Is there any possible way to achieve this either on AWS, vps or any other cloud server? Does this query run good and fit my requirement?
$conn =new mysqli('localhost', 'root', '');
$sql = "CREATE DATABASE $dbname";
if ($conn->query($sql) === TRUE) {
mysqli_select_db($conn,"$dbname");
}
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: uncaught mysqli_sql_exception
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.