Skip to content

Manage MySQL database via pre-installed PhpMyAdmin or Adminer

We install PhpMyAdmin to allow you to manage the MySQL database from your or developer’s local browser.

You can do the following:

  • View and edit database table contents
  • Export and import databases

We have created an individual user for each MySQL database so that you could provide access to developers without worrying about other databases. In other words, each project (store) has it own MySQL user, which improves data security.

User guide

  1. We have created file with database credentials for each project. Credentials located in /srv/projects/PROJECT_NAME/.mysql.yml (filename starts with a dot, so, we recommend that you allow the display of hidden files in your file manager) and contain access to the database and PhpMyAdmin. You can find connection links in your Scalesta account. Go to Server panel manager and open Tools menu.

    database access

    [developer@ip-10-0-110-248 ~]$ cat /srv/projects/[PROJECT_NAME]/.mysql.yml
    ## DO NOT EDIT OR REMOVE THIS FILE!
    
    # START Access for the database for the [PROJECT_NAME] project (ssh/code)
    db: PROJECT_NAME
    username: PROJECT_NAME password: 2JuWIulUSRteStANMszV
    # END Access for the database for the [PROJECT_NAME] project (ssh/code)
    
  2. Open the link to access PhpMyAdmin, for example. The PhpMyAdmin panel will open. If you want to view the store database, use the access from block “Access for the database for the PROJECT_NAME project”. Access website email

    If you want to get full access, for example, create a new database or user, please, contact us via Scalesta account.

  3. That’s it. You are ready to manage the database. Access website email

MySQL database backup

Backing up MySQL

  1. Open the database in PhpMyAdmin.
  2. Open the Export tab.
  3. Click Go.

Hint

The Custom - display all possible options mode allows:

  • Export tables separately

  • Enable the Add DROP TABLE mode to delete old tables before import.

Access website email

Restoring the database from the backup

  1. Open the database in the PhpMyAdmin panel.
  2. Open the Import section.
  3. Restore data from the backup file.

Managing large databases

Connect to the server via SSH.

To create a backup and archive it, run the following command:

mysqldump -u USER -pPASSWORD DATABASE --single-transaction | gzip > ./backup_DATABASE.sql.gz

To restore a backup from the .sql file, run the following command:

mysql -u USER -pPASSWORD DATABASE < /path/to/dump.sql

If the backup is compressed (the file has the .gz format), unzip the archive, using the following command:

tar -xvzf /path/to/archive.tar.gz

To restore the backup from the archive with one command, run this command:

gunzip < /path/to/outputfile.sql.gz | mysql -u USER -pPASSWORD DATABASE

or this one:

zcat /path/to/outputfile.sql.gz | mysql -u USER -pPASSWORD DATABASE

Hint

If you have a problem, need assistance with tweaks or a free consultation, if you just want to discuss your project with experts and estimate the outcome, if you're looking for a solution that reinforces your online business, we will help. Let us know through Scalesta account.