-2

I'm new to PHP and MySQL and I'm having a problem with MySQL database, on how to create that username-password combination for the mysql_connect() function on a Mac 10.10. Have a look at this excerpt of code from WROX book: Beginning PHP5, Apache and MySQL web development. Please help me, thanks in advance.

<?php

$connect = mysql_connect("localhost", "b5pm", "bm5pm") or die ("Hey loser, check your server connection.");

$create = mysql_query("CREATE DATABASE IF NOT EXISTS moviesite") or die(mysql_error());

mysql_select_db("moviesite"); ... ?>
Alvarez
  • 25
  • 6

1 Answers1

1

It seems your mac is using a UNIX socket, please change from "localhost" to "127.0.0.1"

Harry
  • 3,031
  • 7
  • 42
  • 67