#!/bin/bash
# Function to check the character encoding settings
check_character_encoding() {
echo "Checking character encoding settings..."
echo "Database Character Encoding:"
mysql -u <username> -p<password> -e "SHOW VARIABLES LIKE 'character_set%';"
echo "Client Application Character Encoding:"
locale charmap
}
# Function to check the table and column settings
check_table_column_settings() {
echo "Checking table and column settings..."
echo "Table and Column Character Set and Collation:"
mysql -u <username> -p<password> -e "SELECT TABLE_NAME, COLUMN_NAME, CHARACTER_SET_NAME, COLLATION_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '<database_name>';"
}
# Function to check the database configuration
check_database_configuration() {
echo "Checking database configuration..."
echo "Database Configuration:"
mysql -u <username> -p<password> -e "SHOW VARIABLES LIKE '%char%';"
}
# Main function
main() {
check_character_encoding
check_table_column_settings
check_database_configuration
}
# Run the main function
main