Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Wordpress Development Track. MAMP. Error establishing a database connection.
MAC . Wordpress Development track. ' Error establishing a database connection. ' I am following the video exactly.
MAMP control panel shows apache port: 80, MySQL port: 3306
When I type in the URL field: localhost I get Index of / Localwp.com Test site.com
Like in the video.
Localhost.com has all of the wordpress files.
Note. Prior to this, I had to use Terminal and the following command because from the MAMP Control Panel, MySQL server would not turn green.
Sudo /usr/local/MySQL/support-files/MySQL.server stop
This must have been causing a conflict with the MAMP (GUI) that I installed with the course because then from the MAMP control panel, MySQL server DID turn green.
All of that and I am stuck. Anyone know what I need to do? Thanks,
Resolution and explanation. Below are two problems, related, that I resolved. I hope this clarifies things for others.
1. MAMP = Mac. Apache(server) mysql(database). PhpMyAdmin.
On a Mac running Mountain Lion (different from previous OS), I had installed MAMP MANUALLY. This required a few steps from the command line to start Apache and then to install/configure MySQL and phpMyAdmin. This was done several months earlier.
From the Wordpress Development Track-Course, Zac demonstrates using a DIFFERENT installation of MAMP. The difference is that you end up with a GUI (graphical user interface) of MAMP which provides a control panel. There you can start and stop Apache Server and MySQL server. You can change the ports. This MAMP install is visible in the Applications folder (from the finder).
The PORT configuration. That was part of the problem. My manual installation of MAMP was configured to use the same PORT as the GUI install. This created a CONFLICT.
I had to run commands from Terminal on the Mac. I had to Stop Apache Server from the command line. I had to Stop Mysql Server from the command line.
Then when I clicked on the icon in the dock (I put it into the dock) To launch MAMP, both servers turned green light. It took a little bit for the MySQL to turn green.
- In the tutorial, we came to this. In the URL field type: 'localhost' It returned: Index of Localwp.com ( the folder we created. The wordpress files live there)
In the tutorial, when Zac clicked on that link, it opened a page to CONFIGURE Wordpress. I kept getting the following Error. 'Error connecting to the database'.
After much troubleshooting, decided to download a Fresh version of wordpress. I noticed something when I compared my Old version of wordpress to this Fresh version of wordpress The old folder had two files: Wp-config-sample.php Wp-config.php
The Fresh version Only had Wp-config-sample.php
I deleted the Old version and copied the new version into the Localwp.com folder
Returning to the URL Localhost Brought back up Index of Localwp.com
When I clicked on the localwp.com link It CONNECTED me to the database.
Conclusion (in my humble opinion). I had corrupted the created wp-config.php file. When I started Fresh, The process used the wp-config-sample.php file and Recreated the wp-config.php file
I examined both files in my text editor. The wp-config-sample.php had defaults. I could visual see in wp-config,php had settings that I entered for database, user, password, host were what I entered .
I hope this is clear.
Remotely. I had created the 'database' localwp. I had created the 'user'. wpuser.
I had NOT added the user to the database. This fixed the error.
Zac GordonTreehouse Guest Teacher
Do you have MAMP properly up and running now that it's being manager by the MAMP GUI? I was unclear what your question was..