iHost – MySQL Database

MySQL database support is provided as a service for iHost users. By running php programming language on the iHost server, you can write programs to access MySQL database for applications such as addressbook, online surveys, and more.

A default database called “acctname_db” (e.g. webitsc_db) will be created along with your iHost account. You can manage your database using mysql username (the same name as your iHost account) and mysql password. For the database server, please specify localhost.

Working with MySQL Database

Access Your Database via phpMyAdmin

Before writing programs to access MySQL database from the iHost server, you may want to create the required tables using the phpMyAdmin interface, depending on which web hosting server. You will need to establish a Secure Remote Access (VPN) connection before you can connect to phpMyAdmin for security reasons:

  1. Invoke the SSL VPN client Pulse Secure (see VPN Client Installation for installation)
  2. Connect to HKUST Remote VPN using your account name, passwordand approve the connection using your mobile device (Using Secure Remote Access (VPN) with 2FA).
  3. Access to phpMyAdmin specific to your host using port 9003 e.g. 
    https://webhost5.ust.hk:9003/phpmyadmin/index.php or 
    https://webhost6.ust.hk:9003/phpmyadmin/index.php

After logging on to phpMyAdmin using your mysql username and mysql password, it is straightforward to manipulate your database. For example, you can create new tables, flush the table to reclaim space from deleted records, export your database to files, etc.

Back Up/Restore Your Database

You are advised to backup databases regularly to prevent data loss:

  1. Log on to phpMyAdmin using your mysql username (the same as your iHost account) and mysql password.
  2. Select the database to be backed up from the column on the left, e.g. webitsc_db.
  3. Click on the Export tab.
  4. Check the Save as File option.
  5. Click the Go button to save the database to your local hard disk.

Restoring your database is as easy as backing it up but be aware that you will lose all changes since your last backup. To reload your backup to overwrite your database:

  1. Log on to phpMyAdmin using your mysql username (the same as your iHost account) and mysql password.
  2. Select the database from the column on the left, e.g. webitsc_db.
  3. Click all the check boxes next to the table names.
  4. Select Drop in the With Selected drop down listbox and click Yes to confirm removing all your data.
    Note: You will lose all your data after this action until you successfully restore your last backup. However, any changes to your database after your last backup will be lost.
  5. Click on the Import tab.
  6. Click on the Browse button and select the SQL backup file you wish to upload to the server.
  7. Click the Go button to confirm the reload.

Change mysql Password

You can change your mysql password inside phpMyAdmin. Please do remember the mysql password as it cannot be reset.