Install MySQL on Debian 10 Cloud Server

Install MySQL on Debian 10 Cloud Server

MySQL is the leading database application for running thousands of apps across the web every day. And more than remote services, MySQL can be used locally with all sorts of popular database management apps. MySQL (or other open source variations) is widely supported and required to run many of the most popular web apps and content management systems, such as WordPress, Joomla, and Drupal. Installing MySQL on Debian 10 requires a few extra steps that you may not always have to run through with other software, but after running through this article you’ll have all the tools you need to get started. (If you are on a managed VPS, also known as VPS cPanel hosting, then MySQL is already installed and you do not need to follow the steps listed here.)

Using The APT Repository

By default, the MySQL packages you will need are not present in the APT repository. However, you can install the MySQL APT repository by downloading the .deb package and following a few basic steps.

Download The Correct Package

First, log into your server as the root user, or a sudo user with appropriate privileges, and download the .deb package for the MySQL package archive. For the download, this example will be using wget. If you get an error, you might need to first install wget. To check if wget is installed, you can run which wget. If you get a result similar to /usr/bin/wget, you’re good to go. The version in bold may be different. Check to see what the current version is.

wget -c https://repo.mysql.com/mysql-apt-config_0.8.18-1_all.deb

Install The Package

You can now install the release package using dpkg. Remember, if you are not using the root user, you will just need to prepend sudo to the following command.

dpkg -i mysql-apt-config_0.8.18-1_all.deb

If you get an error about missing packages, run a apt update and install any missing dependencies.

If everything went well, you will be prompted with a menu to select your MySQL version and other components. If unsure, leave the default options and TAB down to OK.

Now the MySQL repository should be installed on your system, and you can proceed with the MySQL installation process.

Before proceeding to the installation process, make sure to run an update command to refresh your package repositories:

apt update

Installing Your MySQL Server

Now, this part should be more familiar to anyone who is accustomed to using the APT package manager and the standard update and install commands. Now that you have installed the repository packages for MySQL, you can not only install the mysql-server application but also additionally MySQL-related components and packages that you might need. Below, we will continue with the installation process by installing only the mysql-server.

Install MySQL Using APT

To proceed with the installation of the MySQL server package as well as other related components, just run the following command. (Again, if you are logged in a sudo user, you will just need to prepend sudo to this command.

apt install mysql-server

The Installation Process

You will be prompted with a few additional questions during the installation process. First and foremost you will be prompted for a MySQL root password. It is critically important to remember this root password. Alternatively, if you leave the password blank, your system will use altnerative authentication methods. Again, if using a root password (which is recommended) be sure to remember your root password and keep it in a safe place.

Enter your root password and TAB down to OK. Press Enter and the installation process will proceed. When returned to your prompt, MySQL is installed.

To make sure that MySQL is running, you can use this command:

systemctl status mysql

Take note, that the MySQL service will be enabled in your system from now, and it will start automatically after reboot. This means no further action is required on your part to make sure that MySQL is running properly in your system. You are free to start using MySQL to build your server apps.

With our Cloud Server Hosting, you can deploy a lightning-fast, reliable cloud platform with built-in redundancy – ensuring the availability of your environment!

CM
Christopher Maiorana Content Writer II

Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.

More Articles by Christopher

Was this article helpful? Join the conversation!