Personal Homepage – MySQL Database

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

A default database (e.g. 1001_db) will be created along with your personal homepage account (the database server name "localhost".) You can manage the database using your mysql username (e.g. user1001) and the Initial mysql password

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:

https://home.<hostname>.ust.hk/phpmyadmin/

i.e.
For Staff: https://home.people.ust.hk/phpmyadmin/
For Student: https://home.student.ust.hk/phpmyadmin/
For Student Society: https://websoc.hkust.edu.hk:9003/phpmyadmin/  (Old: https://home.student.ust.hk/phpmyadmin/)
For Alumni Association: https://websoc.hkust.edu.hk:9003/phpmyadmin/  (Old: https://sftp.alumni.ust.hk/phpmyadmin/)

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. 1023_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. 1023_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 (optional)

You can change your mysql password inside phpmyadmin if it is necessary.

https://home.<hostname>.ust.hk/phpmyadmin

i.e. 
For Staff: https://home.people.ust.hk/phpmyadmin/
For Student: https://home.student.ust.hk/phpmyadmin/
For Student Society: https://websoc.hkust.edu.hk:9003/phpmyadmin/  (Old: https://home.student.ust.hk/phpmyadmin/)
For Alumni Association: https://websoc.hkust.edu.hk:9003/phpmyadmin/  (Old: https://sftp.alumni.ust.hk/phpmyadmin/)

Note: To change the SQL password for Student Society/Alumni Association, please run the following SQL command within phpmyadmin:

alter user 'userxxxx'@'localhost' identified by '<new password>';

Do rember your new mysql password as it will not shown in Your Personal Homepage Quota and MySQL settings and you cannot reset it again.