DB dump does not work as expected
Hi and thanks for this amazing tool !
Description The documentation, states that we can perform a DB dump via the following command.
bin/mysqldump > ~/Sites/existing/magento.sql
I just try an that return an error
Steps To Reproduce
- Install the docker-magento through the automated way.
- Try to dump the DB :
bin/mysqldump > ~/Sites/existing/magento.sql - Do you have the error ?
Expected Result
Either an updated documentation for dump the DB or I should have my dump there ~/Sites/existing/magento.sql.
Actual Result
I got the error message following :
In ErrorHandler.php line 61:
Deprecated Functionality: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in phar:///var/www/html/bin/n98-magerun2.phar/src/N98/Magento/Command/Database/Compressor/Uncompressed.php on line 49
Some other inputs
- As far as I understand the error message comes from the abscence of parameter. This command don't throw error :
bin/mysqldump test.sql, but send the dump flow in test.sql in the container, so I can't have it on my host. - If someone need a quick fix :
cd <root_project>
make mysqldump dump.sql
make clinotty cat dump.sql > magento.sql
make clinotty rm dump.sql
Ref: https://github.com/netz98/n98-magerun2/issues/999
I'll keep this ticket open until the above is resolved, but it appears to be a prob with the n98 cli tool.
Hello, same error here. The mysqldump process runs, but the contents of the resultant sql file are only:
Downloading n98-magerun2.phar, just a moment...
n98-magerun2.phar: OK
I tried @nicolaspernot 's alternate solution above, but I don't know where the sql file is being dumped to.
Any guidance would be most welcome and appreciated!
@nicolas-medina @robert-j-peterson
My workaround is below:
cd <root_project>
# Dump SQL file in container
bin/n98-magerun2 db:dump magento.sql
# Copy SQL file from container to local
bin/copyfromcontainer magento.sql
# Remove SQL file in container
bin/cli rm magento.sql
# Your SQL file will be in local `src/magento.sql`
ls src/magento.sql
BTW: stripped some tables for speed up and smaller size db:dump
bin/n98-magerun2 db:dump --strip="@stripped" magento.sql
ahhhh that copyfromcontainer command looks useful -- thank you!
@nicolaspernot @markshust It's fixed in n98-magerun2 version 5.2
# Remove old n98-magerun2
bin/cli rm bin/n98-magerun2.phar
bin/n98-magerun2 --version
# Downloading n98-magerun2.phar, just a moment...
# n98-magerun2.phar: OK
# n98-magerun2 5.2.0 (commit: e11be34) by netz98 GmbH
# Works !!!
bin/mysqldump > ~/Sites/existing/magento.sql
Ah thanks! n98 isn't baked into any image (see https://github.com/markshust/docker-magento/blob/master/compose/bin/n98-magerun2), so the above is the correct fix 👍
Going to close this one out, as I don't think there's really anything for me to do here? 🤷 If there is, please let me know and I'll reopen.