How can i solve this “Warning: mysqli_connect(): (HY000/1049): Unknown database” problem?

前端 未结 4 950
余生分开走
余生分开走 2020-12-06 04:02

I downloaded an Event management software and install wamp server. Everything is fine but when I try to sign up into the website, it is showing me this

( ! )          


        
相关标签:
4条回答
  • 2020-12-06 04:21

    New versions of WAMP seems to install both MySQL and MariaDB. And when I logged in through the phpMyAdmin, I saw that the MySQL is using the port 3308.


    So in my PHP code, instead of using just localhost for my database hostname, I added the port to it like this: localhost:3308 and it worked.

    $db = new mysqli('localhost:3308', 'root', 'password', 'db_name');
    
    0 讨论(0)
  • 2020-12-06 04:23

    How can I solve this “Warning: mysqli_connect(): (HY000/1049): Unknown database” problem?

    If you are very sure you have created the database, then go to your connect file and add the port (3308) to your host variable [private $host = "localhost:3308";]. It's worked for me.

    0 讨论(0)
  • 2020-12-06 04:29

    For me this worked:

    If you are using wamp 3.1.9 the problem is you created the database using MariaDB. Try to create or import the database using Mysql selection as the server choice it will connect.

    0 讨论(0)
  • 2020-12-06 04:38

    In your connection.php line 2 verify your credentials if they're correct for your localhost.

    mysqli_connect("localhost","your_username","your_password","your_database_name");
    

    When we download such a project we first have to check the connection for the database. If you could provide me with your php version and a snippet from your connection.php file.

    0 讨论(0)
提交回复
热议问题