Login Details
The MySQL login details can be found in the file .my.cnf
inside the home directory of the hosting account. You can view this file using SSH or SFTP.
For applications in a non-clustered environment it is most optimal to use the hostname localhost
to connect to MySQL. When you do this the connection will be made using a local unix socket. This only works for local applications on the same server. When you need a TCP connection, for example when you are using an SSH tunnel, you need to use 127.0.0.1
as hostname for MySQL.
PhpMyAdmin
MageHost has PhpMyAdmin available on every server.
You need to know the name of the server your shop is hosted on. If you lost it, go to https://___your_domain___/server and it will show.
The URL of PhpMyAdmin is:
https://__SERVER__.magehost.pro/mh_phpmyadmin
You can use the same login details Magento uses to access the database.
The database user is the same as the SSH/SFTP user of the hosting account.
If you try a wrong password too often, your IP will be blocked from access. If you need to be unblocked contact us.
Create Extra Database
You can create extra databases, as long as you start the name with the username and then an underscore, for example myuser_extradb.
You can do this using SSH:
mysql '' -e 'CREATE DATABASE myuser_extradb;'
Remove a Database
WARNING: Potential data loss
You can do this using SSH:
mysql '' -e 'DROP DATABASE myuser_dbname;'
Direct connection to 3306
A direct connection from your desktop or from another server to the MySQL database is only possible when you use an SSH tunnel. The tunnel is required to protect your passwords and transferred data.
Step 1: Create the SSH tunnel
I this example we are using port 3307
on the local machine to connect to host 127.0.0.1
port 3306
on the MageHost server side.
ssh -p2222 -L3307:127.0.0.1:3306 ___USER___@___SERVER___.magehost.pro
You need to leave the SSH connection open.
Step 2: Connect to MySQL
In another window on the computer where you started the SSH tunnel:
mysql -h127.0.0.1 -P3307 -p -u___USER___
You can also use an application to connect to port 3307
on host localhost
, on the same computer where you started the SSH connection.
See also:
Create a database backup
Restore a Database Backup
Using Sequel Pro / MySQL Workbench