Always make sure your database is secured and has backup scheduling this will help you in the future when your website suddenly failed to functions. By following this procedure you will gain benefits. Do it now!
Create a folder backup to execute the backup
/mywebsite/bin/mysite -u dbmywebsite_a2wp959 -p ‘()*()*())!@#’mywebsite_a2wp959> /path/sql_backups
Create a file in your directory: Remember to use the file not folder name this will cause error if you are in the wrong command line.
username = myecommerce_wp343
password =” 0980@#@#89899OPIP!@”
host = localhost
mysqldump dbheadstar_wp691 > /path/sql_backups >/dev/null 2>&1
If you forget the password of your database then change new password. Otherwise you cannot connect to your database.
METHOD 2: follow these steps:
Create a file named .my.cnf in your /home/username directory, replacing username with your account username.
Make sure you include the leading . in the filename.
Copy and paste the following text into the .my.cnf file. Replace dbusername with the database user and replace dbpassword with the database user’s password:
user = dbusername
password = “dbpassword”
host = localhost
Create a cron job that runs the following command. Replace dbname with the name of the database to back up, and replace path with the path to store the backup file. This example uses backup.sql for the backup’s filename, but you can use any filename you want:
mysqldump dbname > /path/backup.sql
Warning: You need to have a good knowledge of Linux commands before you can use cron jobs effectively. Check your script with your hosting administrator before adding a cron job.