Install WordPress on Your Local Machine
May 5th, 2022 — 2 min read — Gideon Idoko
WordPress is a popular content management system that can be used for both developing and hosting websites. WordPress is built with PHP and uses MySQL as its database.
In this article, you will learn how to install and configure WordPress on your machine for local development purposes. This WordPress installation will mirror the live server environment.
We need to PHP environment to set up WordPress since it's built with PHP.
Installing XAMPP
XAMPP is a PHP development environment that provides an Apache distribution containing MariaDB, PHP, and Perl. XAMPP is used in this article. Download the XAMPP for your OS [here](Familiarity with WordPress). Other alternatives to XAMPP are MAMP and WAMP.
Run the installation file once the download is complete. Open the control panel and start up the MySQL and Apache services as shown below:
Downloading WordPress
Go to the WordPress.org download page and download WordPress. The WordPress version used in this article is v5.9.3.
Extract the downloaded file and copy the wordpress
folder into [xamp installation directory]/htdocs
. The htdocs
(Hypertext Documents) directory is the folder that the apache server searches for files and serves. Navigate to http://localhost/wordpress
to assess the WordPress.
Creating a Database for WordPress
WordPress needs a MySQL database to store websites' data. The information of this database is needed during the initial configuration.
To create a database (DB) we need a name for the DB and the collation (set of rules for how the DB engine compares and sorts characters).
Let's create one:
- Open
phpmyadmin
-- a MySQL Administration tool by opening uphttp://localhost/phpmyadmin
in your browser. - Click on the Databases tab.
- Enter the wordpress for the database name and select
utf8mb4_unicode_ci
as the collation. - Click on the create button.
A database called wordpress
should be created now.
NB: The recommended collation for WordPress is utf8mb4_unicode_ci
hence selected.
Configuring WordPress
To configure WordPress, we need the following information:
- Database name: Which will be the
wordpress
DB we just created. - Database username This is
root
be default. - Database password: This is blank by default.
- Database host: This is
localhost
by default. - Table Prefix: This is
wp_
by default.
Navigate to http://localhost/phpmyadmin
in your browser.
- Select your preferred language (Eg. English) and click continue.
- Click on Let's go on the next screen.
- Enter the database information above and click submit.
- Click on Run Installation.
- Enter WordPress website information and click on Install WordPress.
- Click on Login and login into your newly created website.
Congratulation, You've successfully installed WordPress on your local machine.
Thanks for reading🙂