Upgrade MySQL 5.7 to 8 via Shell script

Here we will write a Shell script to upgrade MySQL 5.7 to 8. #!/bin/bash # Stop MySQL 5.7 server sudo systemctl stop mysql # Backup MySQL 5.7 data sudo mkdir /var/lib/mysql_backup sudo cp -R /var/lib/mysql/* /var/lib/mysql_backup # Remove MySQL 5.7 sudo apt-get remove mysql-server mysql-client mysql-common # Add MySQL 8.0 repository sudo wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb … Read more

Monitor MySQL Error logs from AWS Cloudwatch

Here we will write a Python script that will Monitor MySQL Error logs from AWS Cloudwatch and we’ll notify in case any error is detected. import boto3 import gzip import re import smtplib import os from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart # AWS credentials aws_access_key_id = ‘YOUR_ACCESS_KEY_ID’ aws_secret_access_key = ‘YOUR_SECRET_ACCESS_KEY’ # CloudWatch log … Read more

Python program to monitor disk usage in EC2

Here we will write a Python program to monitor disk usage in AWS EC2 instance, you can use this to on any Linux flavor. import os def get_disk_usage(): total, used, free = os.popen(“df -h /”).readlines()[1].split()[1:4] return { “total”: total, “used”: used, “free”: free } if __name__ == “__main__”: usage = get_disk_usage() print(“Disk usage:”) print(f”Total: {usage[‘total’]}”) … Read more

Simple MySQL Shell script for backup using Mysqldump

Here we will write a Shell/Bash script for taking MySQL backup using Mysqldump command. You can schedule this in cron for daily backups. Shell Script for Backup using MySQLDump: #!/bin/bash # MySQL database credentials user=”your_username” password=”your_password” host=”localhost” db_name=”your_database_name” # Other options backup_path=”/path/to/backup/directory” date=$(date +”%d-%b-%Y”) # Backup filename backup_file=”$backup_path/$db_name-$date.sql” # Dump the MySQL database mysqldump –user=$user … Read more

A Simple Casino Game in C++

A Simple Casino Game in C++: Description: This is a Number Guessing Game. Player deposits an initial amount to start playing game. He guesses a number between 1 to 10 and enters betting amount. If he wins, he will get 10 times of money he bets. If he bets on wrong number, he will lose … Read more

Bank Management System Program in C++

If you are looking for small school or college level project, this Bank Management System can be a good start. This is a simple project where you can implement a bank management system which has following features: Account management: Create and Delete accounts. Deposit amount. Withdraw amount. Balance enquiry. Modify existing accounts. List all accounts. … Read more