Databases

Shell Script to Backup All MySQL databases

Here is a simple bash script that I use to backup all mysql databases from the server: #! / bin / bash TIMESTAMP = $ (date + "% F") //backups will be stored in /backup/mysql BACKUP_DIR = "/ backup / mysql" MYSQL = / usr / bin / mysql MYSQLDUMP = /...

Remove shell script after usage

Here is a small script that does two things: Determinate script’s locationDelete the file #!/usr/bin/env bash // determinate where the script is SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) //...

How to add uuid-ossp extension to PostgreSQL

PostgreSQL UUID (Universal Unique Identifier) is specified by RFC 4122 and has a 128-bit length.  Here We will cover two methods for enabling uuid-ossp extension to PostgreSQL: via CMD and PostgreSQL pgAdmin 4 GUI. Option 1. Enable uuid-ossp...

MySQL connections work only with localhost and not 127.0.0.1

Recently encountered a strange issue on client VPS that MySQL connections were working only when using localhost and not with 127.0.0.1 This was due to the fact that the client had enabled skip_name_resolve in his my.cnf file which prevents MySQL to...

Different Ways to Check MySQL version in cPanel or Linux

By far MySQL is the most popular Relational database management system and knowing which MySQL version you are running can be important in some situations. Here are different ways to check the version of the MySQL server installed on your WHM/...

How to enable remote access to MongoDB 🍃 in cPanel

Here is how to enable remote access to MongoDB in cPanel: Open port on the firewallEnable remote access in mongodb.confCreate a new admin user for mongodb Open default MongoDB port 27017 on firewall Default port for mongodb is 27017 so we need to...

SQL String Concatenation

Have you ever wanted to retrieve a list of values from a table, storing the results in a string? Here is simple yet effective method without having to rely on cursors, while loops, or other complex structures. declare @string varchar(8000) select...

Scheduled restart 🔄 of SQL server

As you may notice, Microsoft SQL Server will gradually consume more and more memory after it starts…Most people (myself included) will wonder if this means that there are memory leaks or unclosed connections.  While you should make sure to close all...

Cover Image by MilesAndryPrower on DeviantArt

MySQL Database Vulnerability Scanning

Here is how to check MySQL databases for malware: Open up PHPMyAdminLook for anything ‘weird’ It’s that simple. What’s ‘weird’ you ask? Well, anything that’s ‘not supposed to be in the database’. What to look for? Here are some examples of items...

How to find and stop SQL injection 💉 attacks

There’s a lot of stuff out there about SQL injection attacks but there’s not much that will help you figure out how to stop these attacks from occurring. First, let’s talk about what a SQL Injection Attack really is. Some people think it’s a virus...

⚠️ SQL server: Terminate database connections

Each application taht uses your SQL Server database creates a connection on the database and this connection continues unless the session is killed or terminated privately within the application. A similar connection is established even for each...