mysqli_connect(): (HY000/2002): No connection could be made

This error message typically indicates that there was a problem trying to establish a connection to the MySQL server. There can be a number of reasons for this error. Here are some things you can try:

  1. Make sure that the MySQL server is running and that you are using the correct hostname and port number in your mysqli_connect() call.

  2. If you are trying to connect to the MySQL server from a remote machine, make sure that the MySQL server is configured to allow remote connections.

  3. If you are using a firewall or security group to block incoming connections, make sure that the MySQL port (3306 by default) is open.

  4. Make sure that the MySQL server is not being blocked by any other firewall or security software on your server.

  5. If you are using a local MySQL server, make sure that you have not specified the localhost address in your mysqli_connect() call. Instead, use 127.0.0.1 or the actual hostname of your server.

I hope this helps! Let me know if you have any other questions.