How to Install MySQL-server on an Apache Web Server in Linux



Linux


In this article, we show how to install MySQL-server on an apache web server on a linux machine.

So the apache web server is a type of server that is widely used on the web.

Apache powers over 50% of websites on the web.

It can run versatile scripting languages such as PHP, Perl, etc, as well as run MySQL as a database in the backend.

In this article, we will show how to install MySQL-server on an apache web server using the Ubuntu linux operating system.

MySQL is a popular, free, open-source database that can be used for database storage on the web. It used by programmers worldwide and is very effective.

To install MySQL on the apache web server in linux, we first want to make sure our linux server is up to date.

To do this, we run the following two lines of code below.



These two lines perform the necessary updates and upgrades to the linux system.

Now we are ready to install MySQL on the apache web server.

This is done by the following line shown below.



This line above will install the latest version of MySQL (which as of this writing is MySQL-server 5.7.20-0).

When you are having this installation done, the shell will prompt you for a password for the MySQL-server.

You must enter in a password and then repeat the password for confirmation.

Once this has been successfully installed, you can test whether MySQL is working right from the linux shell.

You can do this by entering in the following line below.



Where you see username above, substitute this with the user you created the MySQL-server with.

You will then be prompted to enter in the password.

Once you do this, you now have full access to MySQL in the linux shell.

You can do all things with MySQL as normal.

In the code below, I create a database called users and then I show all databases.

Running MySQL on apache web server in Linux

Lastly, I exit the MySQL software with the statement, quit.

This then brings you back to the linux command terminal in the shell.

In a separate tutorial, instead of using the linux shell to execute MySQL code, I show how to install phpmyadmin in order to execute MySQL code, which makes it easier, since it's a GUI program to execute MySQL code.

And this is how to install MySQL-server on an apache web server using the Ubuntu linux operating system.


Related Resources

How to Randomly Select From or Shuffle a List in Python



HTML Comment Box is loading comments...