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 Local WordPress Development Local WordPress Development Migrating WordPress from Local to Live Server

Douglas Danley
Douglas Danley
1,978 Points

What should the 'DB_HOST' be changed to?

In this video, at 04:44 it shows ‘localhost’ as the DB_HOST that is defined on line 28, yet the video is about uploading the site you built locally to a server - what should this be changed to?

2 Answers

Ron McCranie
Ron McCranie
7,837 Points

localhost is what the computer running the code calls itself. That value works in just about any environment as long as your database is on the same machine as the php files. You could also use 127.0.0.1 which means the same thing (except some very rare occasions). So to answer your question, you shouldn't need to change it.

Jared Parmenter
Jared Parmenter
3,434 Points

I had this question also, and found the string my GoDaddy installation was using for the hostname via the Hosting Panel -> Databases -> [the database name I had already setup] -> Details -> Host Name. I imagine it's similar for other providers as well.

Although as Ron points out, it worked perfectly fine for me defining it as 'localhost' in the wp-config file, also. But just fyi in case anyone else out there is looking for where this comes from, if you're doing the local->remote direction :)