Themewaves
How-To

How to Install WordPress on Your Computer

Build and test a WordPress site on your computer before going live.

How to Install WordPress on Your Computer

Why run WordPress on your computer?

To install WordPress on a local machine, set up a web server, PHP, and MySQL on your computer. Then add WordPress files, create a database, and finish setup in your browser. The site stays on your computer, so you can test themes, plugins, and settings without changing a live site.

A local development environment provides the server tools WordPress needs. MAMP and XAMPP bundle those tools in one install. Local is another option, with a guided setup made for WordPress sites. This walkthrough covers MAMP and XAMPP on Windows and macOS.

A local site is private by default. Visitors cannot reach it over the public web unless you add special network tools. Keep a separate backup if the work matters. A computer fault can still erase local files.

Check the needs before you install

Choose a current Windows or macOS computer with enough free disk space for the server package, WordPress, and site files. A few gigabytes of spare space is a sensible start for a small test site. You also need permission to install software and a web browser.

WordPress needs PHP and a MySQL-compatible database, such as MariaDB. Bundled server tools include these parts, but versions change over time. Check the WordPress server requirements before installing. Match the PHP and database versions to the needs of your WordPress version and plugins.

Pick one server package, rather than running MAMP and XAMPP at the same time. Both may try to use the same ports. Close other web server tools before you start. If a port conflict appears, stop the other service or change its port.

  • Windows or macOS with admin rights
  • A current browser and a stable internet connection
  • MAMP or XAMPP from its official site
  • WordPress files from WordPress.org

Install MAMP or XAMPP

For MAMP on macOS, download the installer from the MAMP site. Open the package and follow its prompts. Start MAMP, then choose Start Servers. Its default web root is usually the htdocs folder inside the MAMP folder.

For MAMP on Windows, download the Windows installer and run it. Keep the default component choices unless you have a reason to change them. Open MAMP and start its servers. Use the shown document root, often a MAMP folder with an htdocs subfolder.

For XAMPP on Windows, get the installer from Apache Friends. Run it, keep Apache and MySQL selected, and finish the setup. Open the XAMPP Control Panel. Start Apache and MySQL with their Start buttons.

For XAMPP on macOS, download the macOS installer and follow its prompts. Open the XAMPP manager, then start the Apache and database services. The web root is commonly /Applications/XAMPP/htdocs on macOS and C:\\xampp\\htdocs on Windows. Check the package if your setup uses a different path.

  • MAMP: start its servers before opening the local site.
  • XAMPP: start Apache and MySQL in the control panel.
  • Place site folders inside the package's document root.
Graphite storage device beside a vivid red panel in a minimal computer setup
Prepare a computer for local server tools

Download WordPress and make a database

Download the WordPress zip file from WordPress.org. Extract it, then move the resulting wordpress folder into the server's document root. Rename that folder if you want a shorter local address. For example, a folder named shop opens at localhost/shop.

Next, open phpMyAdmin in your browser. XAMPP often links to it from its control panel. MAMP commonly provides a phpMyAdmin link from its start page. If the link is missing, check the package's local start page or documentation.

In phpMyAdmin, choose the Databases tab. Enter a name such as wp_test, then create the database. Use a simple name without spaces. The local database user is often root, but the password depends on the package and setup. Check its settings instead of guessing.

Keep a note of the database name, user, password, and host. The host is commonly localhost. Those values connect WordPress to the database, which stores posts, settings, and user details. A blank database is ready for WordPress to fill during setup.

Vivid red storage box and graphite drive arranged for organizing local site files
Organize WordPress files and local data

Open your local site in a browser. For a folder named shop, try localhost/shop. WordPress should show its setup screen. Choose a language, then enter the database name, user, password, and host you saved.

If WordPress asks about wp-config.php, it can often create the file for you. If that fails, copy wp-config-sample.php in the WordPress folder and rename the copy wp-config.php. Open it in a plain text editor and set DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST to your local values.

Save the file, then reload the setup page. Use the database name you made in phpMyAdmin. A common local host is localhost, but follow your server package's guidance if it differs. Do not use a real site's database details here.

Finish the form with a site title, admin name, and strong password. Avoid reusing a live site's password. WordPress will then create its tables and open the dashboard. The official WordPress install steps cover the standard setup flow.

Red cable and graphite device arranged to represent a local database connection
Connect a local WordPress site to its database

Test your site and set local options

Visit the home page, sign in at /wp-admin, and check the dashboard. Make a test post, add a theme, and try any plugins you plan to use. Check that images upload and links work. If something fails, confirm that Apache and MySQL are running first.

What are local settings in WordPress? They are the site options and server details used by this local copy. Set the site title, time zone, permalink format, and reading options under Settings. Keep email, payment, and form tests pointed at safe test tools. A local site may not send email as a live host does.

To avoid accidental public exposure, do not place private customer data on a test site. Use sample accounts and content. Keep plugins updated, but test updates locally before applying them to a live site. That makes a local install useful for finding layout and feature issues early.

For a setup error, check the database name and user first. Then check the password, host, and database service. If the browser cannot reach the site, verify the folder path and server status. Small checks often reveal the cause.

Minimal red chair beside a graphite desk for testing a local WordPress site
A quiet space for testing a local site

Plan the move from local to live hosting

A local site does not become live by copying one folder alone. The live host needs WordPress files, a database, and settings that point to that host. You also need to replace local addresses with the public domain. A migration plugin can handle much of this work.

For a manual move, export the local database from phpMyAdmin. Upload the WordPress files to the live server, then create a database there. Import the exported data and update the live wp-config.php with the new database details. Use a trusted search-and-replace tool to change local URLs in the database.

Make a full backup before you move anything. Test the live site with a temporary address or staging area when your host offers one. Check images, links, forms, and sign-in. Then point the domain to the host and confirm that secure browsing works.

Never overwrite a working live site without a backup and a rollback plan. Local and live servers can use different PHP versions or settings. Test key pages after launch, and fix broken links or missing media promptly. For a small site, a host migration plugin may be simpler than a manual move.

Step-by-step

  1. 01
    Install a local server package

    Install MAMP or XAMPP for your operating system. Start its web server and database service.

  2. 02
    Add WordPress files

    Download and extract WordPress. Place its folder in the server package's document root.

  3. 03
    Create a database

    Open phpMyAdmin and create a database. Save its name and the local login details.

  4. 04
    Set the database link

    Open the local site and enter the database details. If needed, add them to wp-config.php.

  5. 05
    Finish setup and test

    Create the site admin account, then test posts, themes, plugins, images, and settings.

  6. 06
    Prepare a live move

    Back up the files and database. Copy them to a host and replace local addresses before launch.

Frequently asked questions

Can I install WordPress on my computer for free?
Yes. MAMP, XAMPP, and WordPress are free to use for a local test site. Your computer still needs enough space and permission to install the server tools.
Do I need a domain name to run WordPress locally?
No. Open the site through a local address such as localhost/shop. A domain is only needed when you publish the site online.
Why can't WordPress connect to my local database?
Check that the database service is running and that the database name, user, password, and host match. Also check wp-config.php for typing errors.
What are local settings in WordPress?
They are the site options and server details for the local copy. Common settings include the site title, time zone, permalinks, and database link.
How do I move WordPress from a local server to a live site?
Move the site files and database to your host, then update the live database settings and local URLs. Back up both copies and test the live site before launch.
Share XFacebookWhatsApp

Related reading

About cookies on this site

Essential cookies keep pages loading and the enquiry form working. Anything beyond that is optional and we only set it if you say yes. Details live in our Cookie Policy.