Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning: mysqli::__construct(): (HY000/1045): ProxySQL Error: Access denied for user 'root'@'2a02:4780:bad:f00d::18' (using password: NO) on line 12

I have created a basic page with php and MySQL, but somehow i seem to be getting this error. I Have tried entering my MySQL server password but it shows the same error anyway. I am hosting this page from 000webhost and i have just been introduced to coding.

 <?php
    $username= filter_input(INPUT_POST,'username');
    $password= filter_input(INPUT_POST,'password');
    if (!empty($username)) {
        if (!empty($password)) {
            $host = "localhost";
            $dbusername = "root";
            $dbpassword = "";
            $dbname = "project";

            //create connection
    $conn = new mysqli($host, $dbusername, $dbpassword, $dbname);

    //check connection
    if(!$conn)
    {
     die("connection failed: ". mysqli_connect_errno());
     }
     else{
     echo "Connected successfully";
      }

        }
        else{
            echo "password should not be empty";
            die();
        }

        }
    ?>
like image 229
Shruti Avatar asked Oct 19 '25 20:10

Shruti


2 Answers

Follow these steps:

  1. Make sure database password not contain * special character.
  2. Make sure your database name and database username are correct.
  3. Delete all files from /bootstrap/cache except .gitignore.
like image 155
Kathir Avatar answered Oct 21 '25 09:10

Kathir


Make your database in Database Manager first (in 000webhost). Then, change your $dbusername, $dbpassword, and $dbname as provided by 000webhost.

like image 32
Shany Avatar answered Oct 21 '25 09:10

Shany



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!