Linux Command Line & System Tips
Creating backups for databases and web directory
Posted on: 03/09/2026 10:10
Create the Backup Script
Paste the following script into the file.
Run a test
Message: mysqldump: [Warning] Using a password on the command line interface can be insecure.
You can eliminate this warning completely by moving the password to a secure configuration file that only the root user can read.
Place into cnf file
Ensure no other users on the server can read this file:
Update your backup script
replace it with this
Make the Script Executable
Create the Daily Cron Job
Add the following line at the very bottom of the file to run the backup every single day at 2:00 AM:
Run the following command as the root user:
Verify the Backups Created Successfully
Question, I want to be able to backup each one of these databases on there own
To back up each database into its own separate .sql.gz file automatically, we can update your backup script with a loop. This loop will dynamically read your databases and create individual files for database1, database2, database3, and database4, while skipping system databases like information_schema.
Open the Script File
Replace the Content with the Multi-DB Script
Create the Config FileRun this command to open the MySQL config file:
Lock Down PermissionsFor security, you must restrict this file so only the root system user can read it:
Paste the following script into the file.
Run a test
Message: mysqldump: [Warning] Using a password on the command line interface can be insecure.
You can eliminate this warning completely by moving the password to a secure configuration file that only the root user can read.
Place into cnf file
Ensure no other users on the server can read this file:
Update your backup script
replace it with this
Make the Script Executable
Create the Daily Cron Job
Add the following line at the very bottom of the file to run the backup every single day at 2:00 AM:
Run the following command as the root user:
Verify the Backups Created Successfully
Question, I want to be able to backup each one of these databases on there own
To back up each database into its own separate .sql.gz file automatically, we can update your backup script with a loop. This loop will dynamically read your databases and create individual files for database1, database2, database3, and database4, while skipping system databases like information_schema.
Open the Script File
Replace the Content with the Multi-DB Script
Create the Config FileRun this command to open the MySQL config file:
Lock Down PermissionsFor security, you must restrict this file so only the root system user can read it:
Create New USer in MySQL
Posted on: 31/08/2026 00:43
Adding a new user to MySQL
Create the User
Give the User Access to a Certain Database
Save the Changes
To see all the users in your MySQL database
You cannot see the actual passwords in MySQL
To change the password for a user on a specific database named your_data
Save the changes
(Note: In MySQL, passwords belong to the user account, not to the database itself. Changing this will update the password the user uses to log into the whole MySQL system).
Create the User
Give the User Access to a Certain Database
Save the Changes
To see all the users in your MySQL database
You cannot see the actual passwords in MySQL
To change the password for a user on a specific database named your_data
Save the changes
(Note: In MySQL, passwords belong to the user account, not to the database itself. Changing this will update the password the user uses to log into the whole MySQL system).