-
Notifications
You must be signed in to change notification settings - Fork 0
/
createuser.php
24 lines (17 loc) · 944 Bytes
/
createuser.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
$servername = "localhost:3308";
$username = "root";
$password = "";
try {
$conn = new PDO("mysql:host=$servername", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "CREATE USER 'homeinventorydev'@'localhost' IDENTIFIED WITH mysql_native_password BY 'xFog2f8NIrP6MGpl';GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, FILE, INDEX, ALTER, CREATE TEMPORARY TABLES, CREATE VIEW, EVENT, TRIGGER, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EXECUTE ON *.* TO 'homeinventorydev'@'localhost';ALTER USER 'homeinventorydev'@'localhost' REQUIRE NONE WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;";
$conn->exec($sql);
echo "<br>User <strong>homeinventorydev</strong> created successfully!<br>";
}
catch(PDOException $e){
echo $sql . "<br>" . $e->getMessage();
}
$conn = null;
?>