Himanshu SharmaSoftware engineer
Let’s talk

WordPress · Lesson 3 of 45

Install WordPress on your computer

Set up a local WordPress site to learn and build safely, with WordPress Playground, a local app, XAMPP or WP-CLI, and see what installation does.

14 minGetting startedUpdated 23 October 2026

By the end of this lessonRun WordPress on your own computer, understand the five-minute install, and log in to your new site.

Why install locally?

You will make mistakes while learning, and that is fine, as long as they happen somewhere visitors cannot see. A local site runs on your own computer: it costs nothing, works offline, and you can delete and recreate it in minutes. Professional developers build and test on local sites and only then move changes to the live site (a later lesson covers that).

WordPress needs three things:

  • a web server (such as Apache or Nginx),
  • PHP (WordPress 7.1 requires at least PHP 7.4; use PHP 8.2 or newer),
  • a database: MySQL or MariaDB.

There are several easy ways to get all three.

Option 1: WordPress Playground (no install)

WordPress Playground runs a complete WordPress site inside your browser, using PHP compiled to WebAssembly. Open playground.wordpress.net and a fresh site appears in seconds. It is perfect for trying the dashboard, testing a plugin or following the content lessons.

Its limits: by default the site disappears when you close the tab (you can export it), and it is not meant for real development work with your own code editor. For that, use one of the next options.

Option 2: a local WordPress app

Desktop apps such as Local (free, for Windows, macOS and Linux) are the easiest full setup. You click Create a new site, choose a name, PHP version and an admin username and password, and the app sets up the web server, PHP, database and WordPress for you. It also gives you one-click access to the database and a shell with WP-CLI.

This is the recommended route for most learners.

Option 3: XAMPP or MAMP, by hand

XAMPP (Windows, macOS, Linux) and MAMP (macOS, Windows) bundle Apache, PHP and MySQL/MariaDB. Doing the install by hand once teaches you what the apps automate:

  1. Install XAMPP and start Apache and MySQL from its control panel.
  2. Download WordPress from wordpress.org/download and unzip it into XAMPP's htdocs folder, for example as htdocs/mysite.
  3. Open phpMyAdmin (http://localhost/phpmyadmin) and create an empty database, for example mysite, with the collation utf8mb4_unicode_ci.
  4. Visit http://localhost/mysite. The installer asks for the database name, user (root on a default XAMPP), password (empty by default on XAMPP) and host (localhost). It then writes wp-config.php for you.
  5. Enter the site title, an admin username, a strong password and your email, and click Install WordPress.

That is the famous five-minute install. Log in at http://localhost/mysite/wp-admin/.

Default XAMPP passwords are only acceptable on your own computer. Never use them on a server.

Option 4: the command line with WP-CLI

WP-CLI is the official command-line tool for WordPress, covered fully in its own lesson. If you have PHP, MySQL and WP-CLI installed, a whole site takes four commands:

bash
wp core download --path=mysite
cd mysite
wp config create --dbname=mysite --dbuser=root --dbpass=secret --dbhost=127.0.0.1
wp db create
wp core install --url=http://localhost:8080 --title="My WordPress Site" --admin_user=admin --admin_password="use-a-long-password" --admin_email=you@example.com

Then serve it with PHP's built-in web server, which is fine for local work:

bash
php -S localhost:8080

This course's examples run on exactly this kind of site: WordPress 7.1, installed with WP-CLI, served at http://localhost:8080, with the title "My WordPress Site" and a user called admin. Developers also use Docker (the official wordpress image) or the @wordpress/env package, which starts a ready-made Docker site with one command.

What installation actually did

The installer created the database tables, saved the settings, created your administrator and added some sample content. You can confirm it with WP-CLI:

bash
wp core is-installed
wp option get siteurl
wp user list --fields=ID,user_login,roles
result
http://localhost:8080
+----+------------+---------------+
| ID | user_login | roles         |
+----+------------+---------------+
| 1  | admin      | administrator |
+----+------------+---------------+

wp core is-installed prints nothing: it answers with its exit status (0 means installed), which makes it useful in scripts, such as wp core is-installed || wp core install .... The other two commands show the site address and the first user, who is always an Administrator.

Logging in

Open /wp-admin/ on your site (for example http://localhost:8080/wp-admin/). If you are not logged in, WordPress sends you to the login screen:

http
GET /wp-admin/
result
HTTP/1.1 302 Found
Location: http://localhost:8080/wp-login.php?redirect_to=http%3A%2F%2Flocalhost%3A8080%2Fwp-admin%2F&reauth=1

The 302 Found status and Location header redirect the browser to wp-login.php, remembering where you wanted to go in redirect_to. Sign in with the username and password you chose, and you arrive at the dashboard, the subject of the next lesson.

Choosing the admin username and password

On a local site it hardly matters, but get into good habits now:

  • Avoid the username admin on live sites; bots try it first.
  • Use a long, unique password, ideally generated by a password manager.
  • Use a real email address you control, because password resets go there.

Common mistakes

  • Learning on a live site that customers use.
  • Forgetting to create the database before running the installer, which then cannot connect.
  • Wrong database host or password in wp-config.php, which shows "Error establishing a database connection".
  • Using weak passwords out of habit and carrying them to a live site.

Exercise

Install WordPress locally with any of the four options. Then log in, open Settings → General, and confirm that the Site Title and WordPress Address (URL) match what you chose.

Show one possible answer

With Local: create a site called "Practice", note the admin username and password you chose, click WP Admin, log in, and open Settings → General. The Site Title is "Practice" and the WordPress Address is the local address Local assigned, such as http://practice.local. If you used WP-CLI, wp option get blogname and wp option get siteurl show the same values.

Key points

  • Learn and build on a local site on your computer, never on a live site that visitors use.
  • WordPress Playground runs WordPress in the browser with no installation, ideal for quick experiments.
  • Local apps (such as Local), XAMPP or Docker give you a full PHP, MySQL and web server stack.
  • Installing means creating a database, a wp-config.php that points to it, and running the installer to create the tables and the admin user.

Check yourself

1. Why use a local site for learning and development?
2. What does WordPress need to run?
3. What does the famous five-minute install create?
4. Which is a weak admin password?