I'm a beginner to these mysql. i used the command

"mysqldump -u root -p magento > magentobackup.sql"

but returned a

"Got error: 1036: Table 'catalogsearch_fulltext' is read only when using LOCK TABLES"

. whats the safe command to back up?

4 Answers 4


I've never had a lock tables issue. But the problem is that the search table is trying to be updated whilst you are Dumping.

Generally speaking you should consider putting the store into maintenance mode during a dump to prevent data loss or other issues as MySQLDump does attempt to lock the tables so it can see how much data it needs to load from the whole table. (It doesn't want to miss newly added data so it locks the table but something else has locked it.

You can use the --lock-tables=false option on the MySQLDump command line. But I'd go with Maintenance mode myself.

--lock-tables, -l

Lock all tables before dumping them. The tables are locked with READ LOCAL to allow concurrent inserts in the case of MyISAM tables. For transactional tables such as InnoDB and BDB, --single-transaction is a much better option, because it does not need to lock the tables at all.

  • what would be the best command for it? will it be "mysqldump -u root -p --lock-tables, -I --single-transaction magento > magentobackup.sql" ? I'm a newbie to all of these Mar 30, 2016 at 0:59
  • It's best to experiment and see what works for you. For me a straight flat mysqldump with no special arguments works fine. BUT thats for MY use case. Mar 30, 2016 at 8:58

Please use below command :

php bin/magento setup:backup --db

& after this check in var folder. you will get backup.


You can try this in Linux.

Run the following command:

   ..../bin/php /bin/magento setup:backup --db   

This will create the DB backup in Magento2/var/backups


You can backup db through Magento CLI. Try Following cmd into CLI.

php bin/magento setup:backup --db

Also you can backup codebase, media like following ways

php bin/magento setup:backup --code

php bin/magento setup:backup --media

All the backup comes under var/backups directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.