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 trialJared Parmenter
3,434 PointsWhy doesn't DB_HOST need to be changed in wp-config.php when migrating?
At 5:15 in this vid, you can see that the define('DB_HOST', 'localhost'); statement remains unchanged. I'm confused why this wouldn't be manually changed as well, to something like 'studentshostingdatabases', or some other string provided by the hosting provider?
Background: I did the reverse of this video, that is, migrating a remote SQL db I've been playing with (through the first parts of this track) onto my local environment, to see if there were any hitches in the process.
In my remote wp-config file, this define statement had a very long url plugged in through the hosting SQL setup wizard when creating the original db (something like 'ftp.godaddy.123445678abc123'); noticing this, I changed it over in my local copy of the file to 'localhost' as that seemed pretty logical. Everything is working fine on my setup, at least as far as I can tell.
So, is this DB_HOST actually a necessary bit of info to update, or just a global that's being stored and presented for descriptive purposes somewhere? Ie, would Zac's wp-config file as it appears at 5:15 actually run fine? What differences would he notice if not?
1 Answer
Jared Parmenter
3,434 PointsSorry, this was answered in a different question on the forum already! Woot.
In short, it's just a variable referring to what the database calls itself, not something WP appears to need. Maybe in an advanced edge case.
See here. Thanks Ron McCranie