Build Your Own Database Driven Web Site Using PHP & MySQL - LOGGING ON MYSQL


I am just getting started with PHP & MYSQL. I have had MAMP installed for quite a while and have used it to dabble in local development mostly with Wordpress.

Following along with the instructions in the book "Build Your Own Database Driven Web Site Using PHP & MySQL”; I installed MySQL Server. All the terminal commands were reacting as set out in the book.

But… I am now trying to connect to the MySQL server using the command:

mysql -u root -p

I enter my password and I keep getting the following error:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I even went ahead and changed my password (via MAMP) but still no joy.

I am getting the feeling that there might be some kind of conflict between the MAMP program and the newly installed MySQL Server program but I have no idea how to sort this out.

As you can imagine, I am hyped to get started with the coding/programming (:

How do I solve this?

Thank you in advance for your help


Maybe install a MySQL client for Mac. Sequel Pro is really good.

Make sure for the Host you type: localhost (because MySQL is actually installed on your local machine).

Cheers feketegy! I actually installed the MySQL client (for MAC systems) as quoted in the book. I got that straight from the MySQL site.

Everything isworking fine until I try and connect to the server.

It will not except my existing password as configured via MAMP:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Could you please explain how a new MySQL client (Sequel Pro) may solve this problem?

Thank you for your help


OK, I’m in!!!

I have been searching arounfd the net for the last few hours and found this page:

I enter this into the terminal:

/Applications/MAMP/Library/bin/mysql -uroot -p

and I got:

Welcome to the MySQL monitor.  Commands end with ; or \\g.
Your MySQL connection id is 9
Server version: 5.1.37 Source distribution

Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.


I guess that I had to use the ‘path’ to mysql in MAMP :confused:

Eitherway, I am in so I can continue with the book :smiley: Yay!!

BTW, @ feketegy, I checked out Sequel Pro. That is a very useful bit of kit! It will defo come in handy later on but I really want to nail this Terminal command bit.

Anyway, thanks for replying (thanks for your help)


Glad that you sorted it out and found the answer :smiley: Well done and good job.