You need to stop mysql and then back it up. Note that it may not work properly even after the backup.
If mysql is running normally, it is recommended that you back up the database directly in aapanel

aaP_vikingphp

    aaPanel_Kern

    aaPanel_Kern Backup directory command:
    \cp -rp /www/server/data \www\backup\data_2022

    You told that i have to copy /www/server/data to /www/backup/data_2022,
    Now i want to use /www/backup/data_2022 but when i replace /www/server/data by /www/backup/data_2022 and change /www/server/data ownership to mysql:mysql and restart mysql, mysql stops working immediately. (error: Failed to start mysql service)

    mysql logs:

    2024-11-07T09:20:50.438804Z 0 [Warning] [MY-000081] [Server] option 'max_allowed_packet': unsigned value 107374182400 adjusted to 1073741824.
    2024-11-07T09:20:50.438931Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
    2024-11-07T09:20:50.439096Z 0 [System] [MY-010116] [Server] /www/server/mysql/bin/mysqld (mysqld 8.0.24) starting as process 3955312
    2024-11-07T09:20:50.461738Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
    2024-11-07T09:20:50.468074Z 1 [Warning] [MY-012197] [InnoDB] Unable to open './sys/sys_config.ibd'
    2024-11-07T09:20:50.830635Z 1 [Warning] [MY-012573] [InnoDB] './#innodb_temp/temp_5.ibt' permission error, can't delete!
    2024-11-07T09:20:50.830764Z 1 [Warning] [MY-012573] [InnoDB] './#innodb_temp/temp_10.ibt' permission error, can't delete!
    2024-11-07T09:20:50.830875Z 1 [Warning] [MY-012573] [InnoDB] './#innodb_temp/temp_4.ibt' permission error, can't delete!
    2024-11-07T09:20:50.830987Z 1 [Warning] [MY-012573] [InnoDB] './#innodb_temp/temp_9.ibt' permission error, can't delete!
    2024-11-07T09:20:50.831098Z 1 [Warning] [MY-012573] [InnoDB] './#innodb_temp/temp_2.ibt' permission error, can't delete!
    2024-11-07T09:20:50.831209Z 1 [Warning] [MY-012573] [InnoDB] './#innodb_temp/temp_8.ibt' permission error, can't delete!
    2024-11-07T09:20:50.831325Z 1 [Warning] [MY-012573] [InnoDB] './#innodb_temp/temp_1.ibt' permission error, can't delete!
    2024-11-07T09:20:50.831443Z 1 [Warning] [MY-012573] [InnoDB] './#innodb_temp/temp_6.ibt' permission error, can't delete!
    2024-11-07T09:20:50.831566Z 1 [Warning] [MY-012573] [InnoDB] './#innodb_temp/temp_3.ibt' permission error, can't delete!
    2024-11-07T09:20:50.831686Z 1 [Warning] [MY-012573] [InnoDB] './#innodb_temp/temp_7.ibt' permission error, can't delete!
    2024-11-07T09:20:50.831809Z 1 [ERROR] [MY-012592] [InnoDB] Operating system error number 13 in a file operation.
    2024-11-07T09:20:50.831932Z 1 [ERROR] [MY-012595] [InnoDB] The error means mysqld does not have the access rights to the directory.
    2024-11-07T09:20:50.832047Z 1 [ERROR] [MY-012592] [InnoDB] Operating system error number 13 in a file operation.
    2024-11-07T09:20:50.832161Z 1 [ERROR] [MY-012595] [InnoDB] The error means mysqld does not have the access rights to the directory.
    2024-11-07T09:20:50.832281Z 1 [ERROR] [MY-012126] [InnoDB] Cannot create file './#innodb_temp/temp_1.ibt'
    2024-11-07T09:20:50.832410Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
    2024-11-07T09:20:50.841845Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
    2024-11-07T09:20:50.842414Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
    2024-11-07T09:20:50.843045Z 0 [ERROR] [MY-010119] [Server] Aborting
    2024-11-07T09:20:50.845060Z 0 [System] [MY-010910] [Server] /www/server/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.24)  Source distribution.

      aaPanel_Kern I've changed the #innodb_temp folder chmod to 755 and the problem solved.
      But right now i have this error:

      mysql> check table accounts;
      No connection. Trying to reconnect...
      Connection id:    27
      Current database: uploader
      
      ERROR 2013 (HY000): Lost connection to MySQL server during query
      No connection. Trying to reconnect...
      ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1:3306' (111)
      ERROR: 
      Can't connect to the server
      
      mysql> check table users;
      No connection. Trying to reconnect...
      Connection id:    8
      Current database: uploader
      
      +----------------+-------+----------+----------+
      | Table          | Op    | Msg_type | Msg_text |
      +----------------+-------+----------+----------+
      | uploader.users | check | status   | OK       |
      +----------------+-------+----------+----------+
      1 row in set (0.56 sec)

      @aaPanel_Kern

        12 days later

        9:01:16 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB >
        9:01:16 0 [ERROR] InnoDB: Page [page id: space=2, page number=30] log sequence number 707730347 is in the future! Curre>
        9:01:16 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB >
        9:01:16 0 [Note] Plugin 'FEEDBACK' is disabled.
        9:01:16 0 [ERROR] mysqld: File './mysql-bin.000026' not found (Errcode: 13 "Permission denied")
        9:01:16 0 [ERROR] Failed to open log (file './mysql-bin.000026', errno 13)
        9:01:16 0 [ERROR] Could not open log file
        9:01:16 0 [ERROR] Can't init tc log
        9:01:16 0 [ERROR] Aborting
        9:01:16 0 [ERROR] InnoDB: Page [page id: space=2203, page number=3] log sequence number 664283483 is in the future! Cur>
        9:01:16 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB >
        9:01:16 0 [ERROR] InnoDB: Page [page id: space=4792, page number=0] log sequence number 625072322 is in the future! Cur>
        9:01:16 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB >
        9:01:16 0 [ERROR] InnoDB: Page [page id: space=4792, page number=3] log sequence number 660482520 is in the future! Cur>
        9:01:16 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB >
        9:01:16 0 [ERROR] InnoDB: Page [page id: space=4792, page number=1] log sequence number 625070876 is in the future! Cur>
        9:01:16 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB >
        : Main process exited, code=exited, status=1/FAILURE

          Hello, have you modified the permissions of the directory or file? Or what operations have been done?
          Check the permissions of the /www/server/data directory and files

          aaP_hrkiven