如何在namecheap php中创建数据库连接文件

<?php
    $dbHost="localhost";
    $dbUser="root";
    $dbPassword="";
    $dbName="registration";

    $dbcon=mysqli_connect($dbHost,$dbUser,$dbPassword,$dbName)
         or
             die("Connection failed: ".mysqli_connect_error());
?>

This is my db connection file I use in localhost, but now I am using web hosting using namecheap hosting and my site has registration and admin logging. I filled out the registration file but I have an error message:

"Connection failed: Access denied for user 'root'@'localhost' (using password: NO)"

The same error appeared in the log for the admin.php page.