1and1 Help Centre Categories

print article

Connect to MySQL via Command Line

For Linux packages

Learn how to establish a connection to your MySQL database through the Linux command line.

If the operating system installed on your server has Parallels software included, MySQL will already be installed. The root user for MySQL is renamed to admin for use the the Parallels software. Therefore when logging in, you will login as admin with the initial password that was used to log on to the server as the root user.

If you have chosen a Linux operating system without Parallels software, MySQL will not have been installed and will have to be installed manually.

Step 2
From the table below, find the command that matches the package you are using and enter it into the command prompt.
Please note:
For hosting packages and managed servers, you must replace the data after the command options with that of your own database.
Package Command
Hosting mysql -u dbo123456789 -h db123456789.db.1and1.com -p db123456789
Managed Servers 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
Step 3
You will then be prompted for the password. Please use the initial root password or most recent password if it has been changed.
login as: root
root@74.208.111.111's password:
[root@u12345678 ~]# mysql -u admin -p
Enter password:
Step 4
Now you are at the MySQL Command prompt. You can create databases and tables using SQL as necessary.
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>

For additional information, you may want to reference: