Would you like to learn how to install Apache, PHP, and MySQL? In this tutorial, we are going to install the Apache server, the MySQL server and configure the PHP support on a computer running Ubuntu Linux.

• Ubuntu 20
• Ubuntu 19
• Ubuntu 18
• Apache 2.4.41
• PHP 7.4.31
• MySQL 8.0.22

Equipment list

The following section presents the list of equipment used to create this tutorial.

As an Amazon Associate, I earn from qualifying purchases.

Tutorial - Apache, PHP, and MYSQL installation

Install the Apache server.

Copy to Clipboard

Install the PHP and MYSQL support on the Apache server.

Copy to Clipboard

Edit the Apache configuration file.

Copy to Clipboard

Here is the file, before our configuration.

Copy to Clipboard

Here is the file, after our configuration.

Copy to Clipboard

Restart the Apache service.

Copy to Clipboard

In our example, the PHP version 7.4 was installed on the Apache server.

Create a file to test the PHP installation.

Copy to Clipboard

Here is the file content.

Copy to Clipboard

Open the browser and access the PHP test page.

In our example, the following URL was entered in the Browser:

• http://192.168.2.222/test.php

The Apache server will display the PHP information.

Apache - PHP installation

Congratulations! You installed Apache and PHP on Ubuntu Linux.

Tutorial Apache - MYSQL installation

Install the MYSQL server.

Copy to Clipboard

Access the MySQL command-line.

Copy to Clipboard

The MySQL ROOT account has no password configured.

Configure the ROOT account to use the plugin named MYSQL_NATIVE_PASSWORD.

Copy to Clipboard

Configure a password to the ROOT account of the MySQL service.

Copy to Clipboard

In our example, the password configured was KAMISAMA123.

Save your configuration and exit.

Copy to Clipboard

Try to access the MySQL service using the ROOT account and the new password.

Copy to Clipboard

Verify the authentication plugin and the password configured to the ROOT user account.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Congratulations! You successfully installed the MySQL service on the Apache server.