list the best ways to backup mysql using mysqldump?

Run mysqldump in SSH terminal not in mysql terminal

For all database::

mysqldump --all-databases --single-transaction -u root -p > /all_databases.sql

For one database (rap_song in this case)::

mysqldump -u root -p rap_songs > /your_backup.sql

Now you need to go to / to see your files, mysqldump usually show nothing once its done terminal again avail for new cmd. So if terminal is again avail it means its done!

Non-root user | Permission denied error!

Don’t use /your_backup.sql

use ~/your_backup.sql instead

~/ is your user data directory

Mysqldump without password

You can create a .my.cnf in ~/

[mysqldump]
user=mysqluser
password=userpass

Then chmod 600 ~/.my.cnf

now in your script or crontab don’t mention -p or --password and when your cron or script execute it will automatically pick password from here

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top