How to use MySQL on Hypernode
Table of contents
- 1 Finding your credentials
- 2 What you should know
- 3 Whitelisting your IP address
- 4 How to connect to MySQL
- 5 Creating a MySQL back-up
- 6 Changing your MySQL password
Finding your credentials
Your MySQL credentials are stored in the homedir of application user. You find them in the file
.my.cnf located in /data/web.
[client] host = mysqlmaster.<tagname>.hypernode.io user = app password = JlogA1Sws6XMHmAj7QlP9vpfjLprtpE5
What you should know
- There is no predefined database, so you should create your own.
appuser is the local superuser. This means you can (among other things):
- can create your own databases;
- create users;
- define views and triggers.
- If you want to use a GUI to work on your database we recommend using a local GUI (HeidiSQL) instead of an online GUI (PHPMyAdmin).
Whitelisting your IP address
port 3306 is firewalled on all hypernodes to prevent hackers and bruteforces from connecting to your mysql instance.
Therefor if you want to externally connect to mysql on the hypernode, you’ll need to add a whitelisting entry first on the Byte Service Panel.
Instellingen > Externe database toegang to add ip addresses to the firewall whitelist.
How to connect to MySQL
Use the command line shell on the production node
Because we’ve provided a
~/.my.cnf, you’re all set to go. Just type
mysql and you’re in.
Use the command line shell from a remote host
Use your credentials to connect like so:
mysql --host=mysqlmaster.<tagname>.hypernode.io --user=app --password=mypassword
Using HeidiSQL/PHPMyAdmin to connect to MySQL
Read the following articles on how to use both HediSQL and PHPMYAdmin for HYpernode:
Using an SSH tunnel to circumvent firewalls
If you are blocked by a firewall, you can tunnel the remote MySQL service to your local computer (Mac or Linux). Use this command:
ssh -NL 3306:mysqlmaster:3306 app@.hypernode.io
Voila, now your Hypernode database is reachable through localhost port 3306!
Creating a MySQL back-up
Use the following command using SSH:
magerun db:dump -n -c gz -s @stripped
This will create a compressed SQL file suitable for importing using either Magerun or
mysqlclient. The dump will exclude any logfiles or temporary import tables.
You should consider using Magerun (see above), but if you need to, you can create a mysqldump on the shell. See our documentation at byte.nl (dutch).
You should consider using Magerun (see above), but you could use HeidiSQL to create a database dump.
- Start HeidiSQL.
- Connect to your node.
- Use Tools -> Export database as SQL.
- In the left pane, choose the Magento database.
- Choose a filename to export to.
- Choose appropriate options, notably
- Press Export.
- Go To domain.hypernode.io/phpmyadmin
- Click on “Databases” and select the database.
- Click on “Export”.
- Click on “Go” and the export/backup will be available.
Changing your MySQL password
Login to your MySQL server via the following command:
Enter your MySQL root password. This will get you into the MySQL prompt. Select the database which holds user accounts, here it’s called mysql;
Now change the password for a given user account using this command:
update user set password=PASSWORD('newpassword') where user='username';
Let’s assume here that your username is ‘trial’ and your new password is ‘hypernode’. Your actual command would look like this:
update user set password=PASSWORD('hypernode') where user='trial';
Now your password is changed in the database, but they haven’t filtered into memory yet. Change that by typing:
Your password has been updated. There’s no need to restart the MySQL demon. Exit the MySQL with