Question: I'm using cPanel.
I created a database and a user with it's password.
But when im trying to connect to it using this code

```
$con=mysqli_connect("ahmadhammoud.com", "ahmadham_ahmad", "***********", "ahmadham_dbtest"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error();} mysqli_close($con);

```

I get

```
Warning: mysqli_connect() [function.mysqli-connect]: (28000/1045): Access denied for user 'ahmadham_ahmad'@'206.72.199.253' (using password: YES) in /home/xyz/public_html/scratches/sql/1/index.php on line 3 Failed to connect to MySQL: Access denied for user 'ahmadham_ahmad'@'some_ip_address' (using password: YES)Warning: mysqli_close() expects parameter 1 to be mysqli, boolean given in /home/xyz/public_html/scratches/sql/1/index.php on line 10

```

Someone please help me.. is there something should be done in the settings of the cpanel or what :'\

Answer: 
Try:

```
$con=mysqli_connect("localhost", "ahmadham_ahmad", "***********", "ahmadham_dbtest"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error();} mysqli_close($con);

```

Use `localhost` if you are on same server as your mysql server. Then try change your username, `ahmadham_ahmad` to `ahmadham`:

```
$con=mysqli_connect("localhost", "ahmadham", "***********", "ahmadham_dbtest"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error();} mysqli_close($con);

```
I think you didnt enable remote connection. try to enable remote connection i think then it should work.