Plesk

How to connect to MySQL/MariaDB database hosted on Plesk server from remote machine?

Question

How to connect to MySQL/MariaDB database hosted on Plesk server from remote machine?

Answer

There are several ways to connect to MySQL/MariaDB database remotely:

Click on a section to expand

Command line

  • On Linux:

    1. Make sure that the package mysql-client is installed on the machine.
    2. Access the database with the following command:

      # mysql -u <user> -h <database_server_ip> <database_name> -p

  • On Windows:
    The MySQL Project recommends that Windows users use the client MySQL Workbench to access their database remotely.

Graphical MySQL/MariaDB client

There are a lot of graphical desktop or web-based MySQL/MariaDB clients to manage database servers. For example, phpMyAdmin.
More information about installation and establishing a connection with remote MySQL/MariaDB database server can be found here: https://docs.phpmyadmin.net/en/latest/

Script

For example, in PHP the function mysqli_connect can be used. Check the following link for more details on this: http://php.net/manual/en/function.mysqli-connect.php

Additional information

How to enable remote access to MySQL/MariaDB service on Plesk server?

Exit mobile version