rewardenv / reward

Reward is a Swiss Army knife CLI utility for orchestrating Docker based development environments.
https://rewardenv.readthedocs.io
MIT License
89 stars 13 forks source link

Exporting big (>4GB) database breaks #26

Closed RedSign77 closed 1 year ago

RedSign77 commented 1 year ago

Hey @janosmiko !

When i try to export a bigger database from PHPMyAdmin (more than 4GB the database) then the generated dump file is only 4GB. It's like the process stopped at 4GB. Environment: Magento 2

If i try the dump with the reward command line as the doc:

reward db dump | gzip -c > var/20220629.sql.gz

then the following message showing: mysqldump: Got error: 1449: "The user specified as a definer (''@'%') does not exist" when using LOCK TABLES

I tried qith root acess, but is the same:

reward db dump --root | gzip -c > var/20220629.sql.gz`
mysqldump: Got error: 1449: "The user specified as a definer (''@'%') does not exist" when using LOCK TABLES

The generated sql dump contains the following:

cat var/20220629.sql.gz

-- MariaDB dump 10.19  Distrib 10.4.25-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: localhost    Database: magento
-- ------------------------------------------------------
-- Server version   10.4.25-MariaDB-1:10.4.25+maria~focal

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Current Database: `magento`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `magento` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */;

USE `magento`;

Do you have any suggestion or solution for this?

Thanks, Zoltán

janosmiko commented 1 year ago

I think this issue is not related to the database size as the error message contains errors related to the definers.

I think you should try to dump the stored procedures, triggers, or the view tables and see if that breaks too.

https://www.ducea.com/2007/07/25/dumping-mysql-stored-procedures-functions-and-triggers/

Eg. using this command:

reward db dump -- --routines --no-create-info --no-data --no-create-db --skip-opt

Another idea would be to check the definer users in the database and if they not exists, then create them

RedSign77 commented 1 year ago

Thank you @janosmiko !