I'm trying to connect my html site to my sql server. I'm using Docker so I opened one container for phpmyadmin and another one for mysql
. Using phpmyadmin I've created a data base named items
and a user which I gave him all the grants.
Then, when I'm trying to submit a form an error massage comes.
I've tried connecting from localhost
and I tried from 127.0.0.1
with no success. I've tried connecting from root user and it also haven't no help.
<?php
$name = filter_input(INPUT_POST, 'name');
if (!empty($name)){
$host = "localhost";
$dbusername = "mydatabase_admin";
$dbpassword = "db123123";
$dbname = "items";
// Create connection
$conn = new mysqli ($host, $dbusername, $dbpassword, $dbname);
<form method="post" action="info.php">
Name: <input type="text" name="name"><br>
<input type="submit" value="Submit">
</form>
Warning: mysqli::__construct(): (HY000/2002): No such file or directory in /Library/WebServer/Documents/info.php on line 10 Connect Error (2002) No such file or directory