Manage MySQL/MariaDB on a Cloud Server with Linux

Leave your reply


MySQL is the most popular SQL database on the internet, along with MariaDB (a drop-in replacement commonly used on CentOS 7 and other Linux distributions). Learn the basics of managing MySQL/MariaDB on a Cloud Server with Linux.


  • A Cloud Server with Linux
  • MySQL/MariaDB installed and running.

Note: MySQL/MariaDB is installed and running on a Standard Linux installation by default. If your server was created with a Minimal installation, you will need to install and configure MySQL/MariaDB before you proceed.

Install and Use MySQL/MariaDB

A Standard Linux installation will have MySQL/MariaDB installed. For more information on how to install MySQL/MariaDB on a server with the Minimal installation, as well as an overview of basic MySQL/MariaDB commands, see our article Install and Use MySQL/MariaDB.

Start, Stop, and Restart MySQL/MariaDB

To stop MySQL/MariaDB use the command:

  • Ubuntu 16.04:sudo systemctl stop mysql
  • CentOS 7:sudo systemctl stop mariadb

To start MySQL/MariaDB use the command:

  • Ubuntu 16.04:sudo systemctl start mysql
  • CentOS 7:sudo systemctl start mariadb

To restart MySQL/MariaDB use the command:

  • Ubuntu 16.04:sudo systemctl restart mysql
  • CentOS 7:sudo systemctl restart mariadb

Use phpMyAdmin to Manage MySQL/MariaDB in a Browser

A convenient way to manage MySQL/MariaDB is to use the program phpMyAdmin, which lets you access MySQL/MariaDB through a browser. phpMyAdmin provides a graphical interface, which can be easier to use than the standard command-line interface.

For more information on using phpMyAdmin, see the article Install PHPMyAdmin on a Cloud Server with Linux

Use MySQL/MariaDB From a Different Server

To use MySQL/MariaDB as a remote database, you will need to:

  • Set the access rights for the user.
  • Connect using the IP address or domain name (not localhost) as the server name.
  • Create a firewall policy to allow traffic on port 3306. See our article Creating a Firewall Policy for step-by-step instructions.

There are several different options for setting the access rights for the user. We recommend that you lock the user down to the IP address of the server which will be accessing MySQL/MariaDB.

For example, if the external server is at IP address you would create the MySQL/MariaDB user with a statement like:

GRANT ALL ON my_db.* TO my_db_user@ IDENTIFIED BY 'De%gfgks#2';

This statement will lock down access for that user account such that it can only log in to MySQL/MariaDB from IP address

To learn how to use PHP to connect to MySQL/MariaDB, see the article Connect to a MySQL/MariaDB Database with PHP on a Cloud Server Running Linux