Installing WordPress: Local Setup vs Hosting
· 3 min read
In the last lesson, you learned that WordPress is PHP and MySQL software, not a hosted product.
In the last lesson, you learned that WordPress is PHP and MySQL software, not a hosted product. That means before you can use it, something has to actually run that PHP code and store that database somewhere. This lesson is about where that "somewhere" is, and the two main choices you have: a local setup on your own computer, or real hosting on the internet.
Setting Up A Local Environment
A local setup means installing a small server environment on your own computer, so you can run WordPress without it being visible to anyone else. Tools like XAMPP, Local, or MAMP bundle Apache (or nginx), PHP, and MySQL together so you don't have to install each piece separately. You install WordPress on top of that bundle, and you access your site at an address like localhost or mysite.local in your browser, visible only on your machine.
Why would you want that instead of just getting hosting right away? Three reasons. First, speed: there's no uploading files or waiting on a server, everything runs instantly on your own machine. Second, safety: you can break things, test risky plugins, or try a new theme without any visitor ever seeing a broken site. Third, cost: it's free, and you don't need a domain name yet.
The tradeoff is that nobody else can see a local site. If Tony Stark wants to show his consulting website to a client, a localhost site won't work, because it only exists inside one computer. For that, you need real hosting: a company that runs servers connected to the internet, where your WordPress files and database live permanently and anyone can visit your domain name.
A very common beginner pattern, and a smart one, is to build and test locally first, then move the finished (or mostly finished) site to real hosting when it's ready to go live. This avoids showing visitors a half-built site, and it avoids paying for hosting while you're still experimenting.
Moving To Real Hosting
When you do move to real hosting, you'll meet a few new ideas. A domain name (like tonystarkconsulting.com) is a separate purchase from hosting, usually from a domain registrar. Hosting is where the files and database actually sit. Many hosting companies offer "one-click WordPress installs," which do the installation for you automatically; this is fine for beginners, but it's still worth understanding what's happening underneath, which is exactly what this lesson covers.
If you install WordPress manually (locally or on a host that doesn't offer one-click installs), the steps are roughly:
1. Create a MySQL database and a database user with a password
2. Download WordPress from wordpress.org and extract the files to your server folder
3. Visit the site in a browser; WordPress's installer asks for your database details
4. WordPress writes those details into a file called wp-config.php
5. You create your first admin user (this becomes your dashboard login)
Understanding wp-config.php
That wp-config.php file is worth knowing about now, because you'll see it again. It holds your database name, username, password, and a few security keys. A tiny example of what's inside it:
<?php
define( 'DB_NAME', 'wp_tonystark' );
define( 'DB_USER', 'root' );
define( 'DB_PASSWORD', '' );
define( 'DB_HOST', 'localhost' );
Common Beginner Mistakes
A mistake beginners make locally: using "root" with no password for the database, which is fine on your own machine, but must never be copied directly onto real hosting. On a live server, your database user needs a real password, because that server is reachable by the whole internet, not just you.
Another mistake: forgetting which environment they're working in. It's easy to make changes locally, assume they're "live," and wonder why nothing changed on the real site. Local and hosted WordPress installs are completely separate installations with separate databases, even if they look identical. Moving content between them requires exporting and importing data, not just copying a feeling of "it's done."
It's worth saying a word about choosing a host once you're ready to go live, since "hosting" isn't one single product. Shared hosting puts your site on a server alongside many other websites, and it's cheap but can be slow if a neighboring site hogs resources. Managed WordPress hosting is a step up, tuned specifically for WordPress, often handling updates and backups for you, at a higher price. Cloud or VPS hosting gives you more control and dedicated resources, but expects more technical comfort from you. For a first real site, like an initial version of Tony Stark Consulting's homepage, reputable shared or managed WordPress hosting is usually the right starting point; you can always move to something more powerful later as traffic grows.
Also worth knowing: moving a finished local site to a live host, or a live site between hosts, is called "migration," and it involves exporting the database, copying the wp-content folder (themes, plugins, uploads), and updating the site's URLs inside the database, since WordPress stores its own address in several places. Migration plugins exist specifically to automate this, and most beginners should use one rather than attempting a fully manual database migration on their first try.
Quick Exercise
A quick exercise: install a local WordPress environment using a tool like Local or XAMPP, and get to the point where you can log into your own dashboard at a localhost address. Don't worry about making it look good yet; the goal here is just understanding the installation pieces, which is the foundation for every lesson that follows.
KEEP READING