Search

Install WordPress on a Local Server using MAMP

Many situations will arise where you wish to make changes to your WordPress website, but you’ll want to test these changes before implementing them on the live site. You can achieve this by creating a local version of your site, a process that involves installing WordPress on your personal computer (locally), among other steps.

Installing WordPress locally is also relevant in cases where you want to build an entirely new website. Instead of doing so on a remote server, you can create the site locally on your personal computer. Building a WordPress site in a local environment significantly shortens the development time and is the method that most developers work with.

In this guide, we’ll demonstrate how to install WordPress locally using MAMP. To summarize the guide, you’ll need to perform four steps:

  • Install MAMP on your computer. Relevant for both Windows and Mac systems – the software is no longer limited to Mac users as it used to be.
  • Start the MAMP servers and modify the relevant ports if needed (it might sound complicated, but it’s not).
  • Create a database on your computer where all your site’s information will be stored (a minute’s work).
  • Install WordPress on the local server.

So, let’s begin with the first section and install MAMP on your personal computer…

1. Installing MAMP

The first action to take is to install the MAMP software. The term “MAMP” stands for Macintosh, Apache, MySQL, and PHP, reflecting the fact that MAMP was originally designed for Mac computers only. However, this is no longer the case, and you can run this software on Windows and Linux as well.

MAMP Opening Screen

MAMP is required because it runs PHP – the language in which WordPress is written – and also runs a MySQL database. Essentially, it simulates an Apache server or other servers of your choice on your computer. This allows you to run and execute queries against the database where WordPress stores all the information and content.

Let’s get straight to the point. Go to the MAMP website, download the free software (click the Free Download button), choose the version relevant to your operating system, and install it on your computer.

2. Running the Local Server with MAMP

Once the installation is complete, we need to run MAMP to start the servers on your computer. You have two options for leaving the default port settings or changing them. Here are the two relevant options:

  • First Option – Keep the Apache port as the default 8888. This means that when you access your site in the browser, you’ll also need to specify this port number.
  • Second Option – Change the Apache port to 80 so you won’t need to include the port number in the browser but you’ll be prompted for your password during MAMP’s initial launch and will need to allow the execution.

Choosing between these two options doesn’t affect how MAMP will run or how your site will work. Personally, I prefer the second option since it’s much easier to type your site’s URL in the browser than to start MAMP. But before we change any settings, let’s run MAMP…

Starting MAMP

Open MAMP as you would any software on your computer, and you’ll see a window like this:

Installing MAMP

Click the checkboxes next to Apache Server and MySQL Server to turn them on (they’ll turn green). If they don’t turn on, click the Start Servers button.

Now, if you want to keep the default port settings, you can skip the next step. If you want to change them, proceed to the following section.

Editing Port Settings

To adjust the ports, go to MAMP’s Preferences, and then click on the Ports tab:

Editing MAMP Ports

Change the Apache Port to 80 and click the confirmation button (OK). You’ll be prompted to enter your password at this point. That completes the port settings. Whether you decide to change them or not, the next step is to create the database for your site.

3. Creating the Database

From the initial MAMP window, click the Open WebStart page button, and a browser window will open with the MAMP startup page, which should look similar to this:

MAMP WebStart Page

Note that the window displays details about your access settings for your database (MySQL), which you’ll use later when installing WordPress. Don’t worry about memorizing these at this point; I’ll present them to you later on.

From the menu, click on Tools and then on phpMyAdmin to open the phpMyAdmin module. Then click on the Databases tab at the top of the screen to view the databases:

Create Database using phpMyAdmin

Create a new database by entering a name for the database in the Create Database field. It’s desirable for this name to be relevant in some way to your website’s name. For the purpose of this article, we will create a database named wordpress.

The database name cannot contain spaces and various punctuation marks…

After you’ve entered the database name, click on the Create button, and the database will be created. Now, let’s continue and install WordPress…

4. Installing WordPress

If you’ve previously installed WordPress (manually) on a remote server, this action will be familiar to you. You need to download the latest version of WordPress from WordPress.org. Then open the downloaded Zip file and copy all its contents to the MAMP/htdocs directory.

  • On Mac computers, you’ll find the directory under Applications, so the WordPress files should be in the Applications/MAMP/htdocs/wordpress directory.
  • On PC computers, you should copy the files to the c:/MAMP/htdocs/wordpress directory.

If the ‘wordpress’ directory doesn’t exist, create it yourself. If you plan to run more than one local site, it’s advisable to change the directory name to something meaningful for the site you’re creating (without spaces, of course).

Now let’s start the WordPress installation process. Open your web browser and type localhost/wordpress in the address bar. If you didn’t change the ports as recommended at the beginning of the article, type localhost:8888/wordpress. Of course, if you changed the directory name to something other than ‘wordpress’, enter that name instead.

At this point, you should see the initial WordPress installation screen asking you to select the language you want to work with.

Wordpress Installation - Language Screen

Choose your desired language and click Continue.

Next, you’ll see a screen that describes the database information you need to install WordPress. Simply click the Let’s Go button to proceed to the next screen.

Wordpress Installation - Database Settings

If you receive a database connection error, double-check the details you entered. Still not working? Review the post on fixing the error establishing a database connection.

In this screen, you need to enter the database settings we created earlier. Enter the following information (as shown in the image):

  • Database Name – wordpress (or whatever name you chose when creating the database).
  • Username – root
  • Password – root
  • Database Host – enter localhost
  • Table Prefix – enter wp_

Most likely, you’ll find that most of the fields are already pre-filled with the necessary data. Either way, click the Submit button. If the entered data is correct, you’ll arrive at the next screen:

Running WordPress Installation

Click the Run the Install button, and you’ll see a screen asking you to enter some details about your new site:

Wordpress Installation - Site Information

Enter the relevant information.

Please note that WordPress will insist on you choosing a strong password. Additionally, you can uncheck the Privacy box since Google won’t have access to your local site. However, if you later move this site to a remote server, remember to re-enable this setting through the WordPress admin interface.

Finally, click the Install WordPress button, and you’ll reach the following screen:

Wordpress Installation - Log in Screen

Click the Log in button to access the admin interface of your newly created local WordPress site. Use the username and password you chose during the WordPress installation process.

In Conclusion

I hope that if you followed this post, you’ll find that installing WordPress on a local server isn’t a complicated task. Using MAMP makes it quite simple to run a server in a local environment, create a database, and install WordPress.

Now you can use the new site you’ve created to develop new ideas, test various plugins and themes before using them on your live site.

If you encounter any issues while creating a WordPress site on your computer after following this guide, let us know in the comments, and we promise to help you out… 🙂

Roee Yossef
Roee Yossef

I develop websites & custom WordPress themes by design. I love typography, colors & everything between, and aim to provide high performance, seo optimized websites with a clean & semantic code.

0 Comments...

Leave a Comment

Quick Navigation

Up!
Blog