On October 19, 2021, we have enabled single-sign-on for our Plesk Support Center to provide a seamless login/account experience. This implies that you’ll be able to use a single account across any of our web-facing properties.
If you had already registered your account at Plesk 360 (formerly known as My Plesk) please use one for login. Otherwise please re-register it using the same email address as your existing Zendesk login (support account). It’s essential that you use the same email address on our support center to ensure that your tickets stay attached to the same account.

How to back up/restore a system database in Plesk

Follow

Comments

16 comments

  • Avatar
    Alex Rubio Cazador

    I have a issue when i try to do this command included in a crontab

    plesk db dump DATABASE_NAME > C:\FULL\PATH\TO\FILE_NAME.sql

    when I execute manually the command runs perfect and i can backup all my sql files, but when i use this comend inside a crontab, they create and retund the .sql files empty

    Thank you.

    0
    Comment actions Permalink
  • Avatar
    Denis Bykov

    @Alex Rubio Cazador
    Try using the full path to the executable instead of the alias:

    For Linux:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -u admin DATABASE_NAME > /full/path/to/BACKUP_FILE_NAME.sql

    For Windows Server:

    C:\>"%plesk_dir%\Mysql\bin\mysqldump.exe" -uadmin -p<plesk_admin_password> -P8306 DATABASE_NAME > C:\FULL\PATH\TO\FILE_NAME.sql

    0
    Comment actions Permalink
  • Avatar
    santhosh

    hai am new to plesk am getting error while am updating plesk

    Internal error: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'psa.ServiceInstallations' doesn't exist

    how to rectify this error

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello @santhosh,

    This behavior may be caused by several issues:

    • Server is running out of RAM.
    • Some limits are exceeded on a container or on a hardware node.
    1. Connect to the server via SSH;
    2. Make sure that it is enough memory or container resources:

      # free -m
      # cat /proc/user_beancounters

      There should be enough memory and all 'failcnt' values should be 0. 

      Do the following in order to fix the issue:

      1. If you are leasing a virtual container, please contact your service provider in order to increase container limits.
      2. Increase amount of RAM or SWAP on the server.
    3. After fixing the limits issue, re-run the upgrade How to upgrade Plesk to the next release

    Check this article for reference:
    https://support.plesk.com/hc/en-us/articles/360006408573-Unable-to-open-Plesk-after-upgrade-Table-psa-ServiceInstallations-doesn-t-exist

    0
    Comment actions Permalink
  • Avatar
    Kingsley Felix

    Can i use this to restore a domain that was deleted?

    0
    Comment actions Permalink
  • Avatar
    Alexey Lapshin

    Hello @iamkingsleyf,

    For restoring whole domain (subscription) it is required to use the backup, created by backup manager.
    Navigate Tools & Settings > Backup Manager > select required backup and choose the subscription you need to restore.

    Use the following articles as reference:
    https://support.plesk.com/hc/en-us/articles/115000340534-How-to-create-and-restore-the-backup-for-certain-subscription-domain-
    https://docs.plesk.com/en-US/12.5/administrator-guide/advanced-backing-up-and-recovering-websites/restoring-backups.65200/

     

    0
    Comment actions Permalink
  • Avatar
    Sergio Sanchez (Edited )

    Please note that ...
    plesk db dump <database_name> > /path/to/<dump_name>.sql
    ... and the respective ...
    MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -uadmin <database_name> > /path/to/<dump_name>.sql
    .. as well as the backups generated in the backup manager (I assume the same tools are used) will not backup created events.

    To include events use
    MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -uadmin <database_name> --events > /path/to/<dump_name>.sql

    Would be nice to see this added to the the backup manager as I was quite astonished to see that my database backups do not contain events.

    0
    Comment actions Permalink
  • Avatar
    George Alibegashvili

    Hello @Sergio Sanchez,

    Thank you for your suggestion.

    I've created User voice request for this feature
    https://plesk.uservoice.com/forums/184549-feature-suggestions/suggestions/37900933-include-mysql-events-in-plesk-backups
    Please vote for this suggestion and feel free to discuss it there, the top-ranked suggestions are likely to be included in the next versions of Plesk.

    0
    Comment actions Permalink
  • Avatar
    Gabriel

    Tengo problemas con el volumen de copias de seguridad que genera y me quedo sin memoria. Como configuro para que solo se deje la ultima copia de seguridad y no se acumulen las antiguas?

    0
    Comment actions Permalink
  • Avatar
    Nelson Leiva

    Hola Gabriel

    Puedes encontrar la informacion en la siguiente guia https://support.plesk.com/hc/en-us/articles/115001279669-How-to-limit-the-number-of-server-wide-backups-stored-in-Plesk

     

    0
    Comment actions Permalink
  • Avatar
    mw004 (Edited )

    The following command restores the Plesk psa database from the database dump 'psa_dump.sql' located in the /root directory:

    plesk db < /root/psa_dump.sql

    or 

    plesk db psa  < /root/psa_dump.sql 

    What is the right way ?

    0
    Comment actions Permalink
  • Avatar
    Kuzma Ivanov

    Hi mw004,

    Thanks for the question.

    The right command to restore the psa database from a dump is this one:

    # plesk db < /root/psa_dump.sql

    Just as the KB articles says.

    0
    Comment actions Permalink
  • Avatar
    mw004 (Edited )

    And if the name of the database is test then it should be:

    plesk db test < test_dump.sql

    not

    plesk db < test_dump.sql

    Plesk cuts "_dump.sql" and import the file into the test database ?

    0
    Comment actions Permalink
  • Avatar
    Kuzma Ivanov

    mw004,

    A database dump contains the name of the database in it, so MySQL knows which database is going to be restored from this dump.

    Filename does not play any role.

    0
    Comment actions Permalink
  • Avatar
    mw004 (Edited )

    And if the database is created through mysql cli and not through plesk (and the database is not initialized in plesk ) does this command work? Because if a mysql command is used, the database name must be included. For example:

    mysql -uroot -p test < test_dum.sql

    or

    mysql -u admin -p`cat /etc/psa/.psa.shadow` test < test_dump.sql

    0
    Comment actions Permalink
  • Avatar
    Kuzma Ivanov

    mw004

    The mysql CLI command works fine for me without the database name.

    So, both commands do the same thing:

    # plesk db < db_example.sql

    # mysql -u admin -p`cat /etc/psa/.psa.shadow` < db_example.sql

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request