I am trying to get localhost working on my machine. I am using Mac OSX Snow Leopard. The http://localhost in the browser works, MAMP shows the servers are running all well, and displays the start page.

However, when I try Sequel Pro's 'Socket' tab, with root, root as username and password, it says the username or password are wrong. Badly stuck here, please help!

PS: So what I am trying to do? I am trying to install a local wordpress installation in my localhost folder.

enter image description here

link|improve this question
Flagged off topic - @Capex, hopefully this question will get moved to superuser or serverfault, where you're much more likely to get an answer! – TheDeadMedic Mar 14 '11 at 10:26
feedback

migrated from wordpress.stackexchange.com Mar 14 '11 at 13:03

This question came from our site for WordPress developers and administrators.

3 Answers

First i'd suggest you reference where you got your MAMP build from for local root passwords as they default them to something generally. Also in MySQL you usually have to list a database that you are connecting to (whether you are root or not) for example

mysql -h localhost -u root -p yourpassword yourdatabase

or you can let it prompt you for the PW

mysql -h localhost -u root -p yourdatabase

also if localhost isn't being resolved, you can use 127.0.0.1

I hope this helps you in your endeavor to put up your wordpress!

link|improve this answer
MySQL uses a filesystem socket to connect to 'localhost' - and a network socket to connect to 127.0.0.1. In the original post the client is connecting but access is denied - this implies different settings in the mysql.user table for localhost and the row which is matched by 127.0.0.1 (i.e. a network connection) – symcbean Mar 14 '11 at 13:35
feedback

What value did you put in the 'host' field when you try to connect to your database? Did you put in 'localhost'?

When you go to http://localhost does the Wordpress installation page show up? If you go through the Wordpress initialization steps, can it connect to your local database?

You can check that your website is listening on localhost by opening a terminal window and attempting to connect to the socket:

telnet localhost 3306

If that can't connect, your MySQL database isn't running (or is on a non-standard port).

link|improve this answer
feedback

You may need to reset the password for root@localhost

You must do the following:

Step 1) Add this line to my.cnf
skip-grant-tables
Step 2) Restart mysql
Step 3) Run mysql (no userid or password needed)
Step 4) Run this query
SELECT user,host,password FROM mysql.user WHERE user='root' AND host='localhost'\G

If a row comes back, then set the password as follows:
UPDATE mysql.user SET PASSWORD=PASSWORD('whateverpasswordyoulike') WHERE user='root' AND host='localhost';

If a row does not come back, painful though this may be, you must does the following:
Step 4a) INSERT INTO mysql.user (user,host,pass) VALUES ('root','localhost',PASSWORD('whateverpasswordyoulike'));
Step 4b) SELECT user,host,password FROM mysql.user WHERE user='root' AND host='localhost'\G
This shows every column on a separate row. You will have to set each column as follows:
UPDATE mysql.user SET select_priv='Y' WHERE user='root' AND host='localhost';
UPDATE mysql.user SET insert_priv='Y' WHERE user='root' AND host='localhost';
UPDATE mysql.user SET delete_priv='Y' WHERE user='root' AND host='localhost';
...
Do this until all privs are manually set.

BTW The SQL GRANT command does not work with skip-grant-tables enabled !!!

Step 5) exit mysql
Step 6) Remove or Comment out 'skip-grant-tables' from my.cnf
Step 7) Restart mysql

Give it a Try !!!

link|improve this answer
feedback

Your Answer

 
or
required, but never shown