0

If I code like this:

<?php
$conn = mysqli_connect("localhost", "root", "111111", "???");
mysqli_query($conn, "
    INSERT INTO ?? (
        title,
        description,
        created
    ) VALUES (
        'MySQL',
        'MySQL is ....',
        NOW()
    )");
?>

then the webpage alert like this

Warning: mysqli_connect(): (HY000/2002): No such file or directory in /Applications/mampstack-7.1.10-1/apache2/htdocs/insert.php on line 2

Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /Applications/mampstack-7.1.10-1/apache2/htdocs/insert.php on line 3

What should I do?

elixenide
  • 44,308
  • 16
  • 74
  • 100
부건혁
  • 17
  • 1
  • 4
  • 1
    Possible duplicate of [My database user exists, but I still get an (HY000/2002): No such file or directory](https://stackoverflow.com/questions/20073168/my-database-user-exists-but-i-still-get-an-hy000-2002-no-such-file-or-direct) – elixenide Apr 01 '18 at 06:22
  • mysqli_connect - the fourth parameter is the name of the database you want to use. – Karlo Kokkak Apr 01 '18 at 08:00
  • I had such a problem after running PHP-FPM in a CHROOT. – BurninLeo Jun 15 '18 at 06:43

0 Answers0