Link to home
Start Free TrialLog in
Avatar of xmouser
xmouserFlag for United States of America

asked on

Running WordPress locally and database error

Running this on a MAC

Downloaded and installed MAMP

Extracted the WP files and moved them to:

users/myname/applications/MAMP/Scotty/ Scooty used to be the htdocs folder.

Used the link for myphpadmin to create a database – did not add users or change root password.

Renamed with wp-config-example file to wp-config and added the database name and user, left password blank: '', user is root

Restarted servers.

I can't get the install to run.

From http://localhost:8888/wp-admin/install.php I get error establishing database connection. Same thing from http://localhost:8888/

Help!
Avatar of Tom Beck
Tom Beck
Flag of United States of America image

What do your port setting look like in MAMP Preferences? I set my Apache port to 80 because I don't like typing localhost:8888 all the time.

Is this related to an upgrade to Yosemite? Mine got messed up when I did that but it turned out to be the port settings in MAMP.
Screen-Shot-2015-04-09-at-4.07.17-PM.png
left password blank

If you left the password blank, the installation script won't be able to access the db. Specify the password in wp-config.php and you should be able to connect as expected.
Avatar of xmouser

ASKER

TomBeck - no update new install.

LucasBishop - did that earlier, but will try again. When I had a password I wasn't even getting the 'error connect... screen, just could not find.
Screen-Shot-2015-04-09-at-16.38.45.png
Avatar of xmouser

ASKER

Set password to root, restarted servers and added root as the password in wp-config.php
Avatar of xmouser

ASKER

See attached screenshot:
Screenshot didn't come through, fyi.
After all of those settings have been specified in wp-config.php, are you still receiving "error establishing database connection"? If not, what is the response you're receiving?
Can you connect to MySql through terminal?

Type or paste:

cd /Applications/MAMP/Library/bin

Hit enter then:

./mysql --host=localhost -u root -proot

Hit enter

(might have to add the port number)
Avatar of xmouser

ASKER

Lucas Bishop - yes 'error establish... that's the latest response.

Tom Beck - see screenshot.
Screen-Shot-2015-04-09-at-17.56.29.png
1.) You mentioned editing "wp-config" ~ please make sure you do have the file extension .php on the end of the actual file.
2.) Instead of using 'localhost' try specifying ' ip:port '
define('DB_HOST', '127.0.0.1:8889');

Open in new window

One more thing that is surely an issue. In reviewing your screen shot, there is a combination of stylized and non-stylized quotes in your config file. You're likely using a text editor that is inserting these quotes.

If you look at the attachment you'll see that the values you've entered in are encased in stylized quotes:
User generated image
Avatar of xmouser

ASKER

Yeah using the default text editor for MAC. I'll check, thanks.
Avatar of xmouser

ASKER

Doing 127.0.0.1:8889 gets me this - see screenshot.
Screen-Shot-2015-04-13-at-15.19.06.png
Avatar of xmouser

ASKER

Disregard the above. With localhost:8888/scotty  I get - see attached. I blew out MAMP and started again. Using the MAC text editor.
In wp_config.php you are specifying the database name as 'Mike' but in the recent screenshot of your phpMyAdmin it appears the database name is Scotty

This could be the source of "error establishing database connection".
Avatar of xmouser

ASKER

Scotty, deleted everything and started over. See screenshot.
Screen-Shot-2015-04-13-at-16.37.06.png
ASKER CERTIFIED SOLUTION
Avatar of Lucas Bishop
Lucas Bishop
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of xmouser

ASKER

I get what you mean but I'm using Notes on the MAC. What should I be using?
Avatar of xmouser

ASKER

Oh, found text edit.
Avatar of xmouser

ASKER

Hmm, still looks the same - screenshot.
Screen-Shot-2015-04-13-at-16.45.53.png
Avatar of xmouser

ASKER

Ok the text editor was in plain text - still wouldn't work, made it rich text, then plane text. Now getting: Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.

So some progress.
Avatar of xmouser

ASKER

Got it Lucas - thanks. Created a new sample file, made it rich text then plain text, changed the extension to .php since it automatically changed it and then I could run the install.

Thanks again.
Avatar of xmouser

ASKER

Great job!