# Connect to MySQL using php

**URL:** <https://forum.kirupa.com/t/connect-to-mysql-using-php/315675>\
**Category:** programming\
**Created:** [November 1, 2010, 4:12pm UTC](https://forum.kirupa.com/t/connect-to-mysql-using-php/315675 "2010-11-01T16:12:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![freshy](https://avatars.discourse-cdn.com/v4/letter/f/71c47a/32.png) [@freshy](https://forum.kirupa.com/u/freshy)\
**Post date:** [November 1, 2010, 4:12pm UTC](https://forum.kirupa.com/t/connect-to-mysql-using-php/315675/1 "2010-11-01T16:12:55Z")

</div>

I have the following php code:

\<?php  
$host=“localhost”;  
$db=“kirupa”;  
$user="";  
$pass="";  
$connect=mysql\_connect($host,$user,$pass) or die (mysql\_error());  
mysql\_select\_db($db,$connect);  
?\>  
I type in the browser : [http://localhost/connectMySQL.php](http://localhost/connectMySQL.php), and I get the following message:

Warning: mysql\_connect() [function.mysql-connect]: Access denied for user ‘ODBC’@‘localhost’ (using password: NO) in C:\xampp\htdocs\connectMySQL.php on line 6  
Access denied for user ‘ODBC’@‘localhost’ (using password: NO)

Looking for expert to pinpoint my mistake.
