diff options
Diffstat (limited to 'automated/linux/lemp/html/create-db.php')
-rw-r--r-- | automated/linux/lemp/html/create-db.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/automated/linux/lemp/html/create-db.php b/automated/linux/lemp/html/create-db.php new file mode 100644 index 0000000..e6bf219 --- /dev/null +++ b/automated/linux/lemp/html/create-db.php @@ -0,0 +1,22 @@ +<?php +$servername = "localhost"; +$username = "root"; +$password = "lemptest"; + +// Create connection +$conn = new mysqli($servername, $username, $password); +// Check connection +if ($conn->connect_error) { + die("Connection failed: " . $conn->connect_error); +} + +// Create database +$sql = "CREATE DATABASE myDB"; +if ($conn->query($sql) === TRUE) { + echo "Database created successfully"; +} else { + echo "Error creating database: " . $conn->error; +} + +$conn->close(); +?> |