# MySQL Error - How do I solve this?

**URL:** <https://forum.kirupa.com/t/mysql-error-how-do-i-solve-this/236909>\
**Category:** programming\
**Created:** [August 24, 2007, 7:54pm UTC](https://forum.kirupa.com/t/mysql-error-how-do-i-solve-this/236909 "2007-08-24T19:54:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Syous](https://avatars.discourse-cdn.com/v4/letter/s/57b2e6/32.png) [@Syous](https://forum.kirupa.com/u/Syous)\
**Post date:** [August 24, 2007, 7:54pm UTC](https://forum.kirupa.com/t/mysql-error-how-do-i-solve-this/236909/1 "2007-08-24T19:54:42Z")

</div>

Alright I have a connect script and when I test it, I get this error message

```php
Could not connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

```

For the sake of it, here is the connect script.

```php
$host = "localhost";
$user = "david";
$pass = " *****";
$link = mysql_connect($host, $user, $pass);
if (!$link) {
   die('Could not connect: ' . mysql_error());
}
mysql_select_db("davidwin_admin") or die(mysql_error());

```
