Connecting to MySQL/MariaDB Databases with the Command Line Environment
Please use the “Print” function at the bottom of the page to create a PDF.
For Linux Web Hosting and all servers with Linux operating systems
You may find it useful to test statements that will later be executed by a script in the command line environment beforehand. To access your database from the command line, follow these steps:
- Log in to your hosting package or server through SSH.
- Depending on the type of package you are using, enter the respective command from the table below. Make sure you replace the sample data with your database's connection data:
Product | Command |
---|---|
Managed Server on which MySQL 5.7 / 8.0 or MariaDB is installed and Web Hosting (Shared Hosting) | mysql -u dbo123456789 -h db123456789.db.1and1.com -p db123456789 |
Managed Server on which MySQL 5.5 is installed | mysql -u dbo123456789 -h localhost -S /tmp/mysql5.sock -p db123456789 |
Servers (without Plesk) | mysql -u root -p |
Servers (with Plesk) | mysql -u admin -p |
Please Note
On servers with Plesk, the administrative database user has been renamed from root to admin. However, the password corresponds to the initial password of the server (root password).
Log in to your database.
Here is an example of a server with Plesk:
login as: root
root@74.208.111.111's password:
[root@u15376217 ~]# mysql -u admin -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9342
Server version: 5.5.14 MySQL Community Server 5.5 (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
You can now perform database operations through the command line interface.