added create db script
This commit is contained in:
parent
92a9c62a2d
commit
f061752bdf
24
dev_mvc/tests/createdb/index.php
Normal file
24
dev_mvc/tests/createdb/index.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
$host="172.21.0.3"; //docker sql container bridge ip
|
||||
|
||||
$root="root";
|
||||
$root_password="rootpass";
|
||||
|
||||
$user='forumadmin';
|
||||
$pass='doesntmatter';
|
||||
$db="webforum";
|
||||
|
||||
try {
|
||||
$dbh = new PDO("mysql:host=$host", $root, $root_password);
|
||||
|
||||
$dbh->exec("CREATE DATABASE `$db`;
|
||||
CREATE USER '$user'@'localhost' IDENTIFIED BY '$pass';
|
||||
GRANT ALL ON `$db`.* TO '$user'@'localhost';
|
||||
FLUSH PRIVILEGES;")
|
||||
or die(print_r($dbh->errorInfo(), true));
|
||||
|
||||
} catch (PDOException $e) {
|
||||
die("DB ERROR: ". $e->getMessage());
|
||||
}
|
||||
?>
|
||||
Loading…
x
Reference in New Issue
Block a user