Browse our MySQL & MariaDB Database articles here. We’ve documented and provided tutorials on installing, managing, backing up, restoring and performance tuning databases.

All HowTo's Cybersecurity MySQL & MariaDB Scripting in Bash

Dump and Backup all MySQL Databases into their own files

This article demonstrates how to backup all MySQL databases into their own files and then tar the lot including system files. #!/bin/bash TO=”/root” FROM=”/etc /var/www/html /var/backups” DBUSER=”root” DBPASS=’MyPassword’ THISHOST=`hostname` DBLIST=`echo “show databases;” | mysql –password=$DBPASS -u $DBUSER | egrep -v ‘^Database$|^information_schema$|^mysql$’` for DBLOOP in `echo $DBLIST` do mysqldump -u $DBUSER

Read more
All HowTo's MySQL & MariaDB

Interacting with MySQL using PHP with OpenShift

This article shows how to use PHP to access a database from within OpenShift. In this case the PHP code is accessing the MySQL database within the same application. function db_connect() { $db_username = getenv(‘OPENSHIFT_MYSQL_DB_USERNAME’); $db_password = getenv(‘OPENSHIFT_MYSQL_DB_PASSWORD’); $db_host = getenv(‘OPENSHIFT_MYSQL_DB_HOST’) . “:” . getenv(‘OPENSHIFT_MYSQL_DB_PORT’); $db_name = “mydbname”; $conn =

Read more
All HowTo's Cybersecurity Linux MySQL & MariaDB Redhat, Fedora and CentOS Linux

Reset a lost MySQL Password on CentOS and Redhat Linux

Use these instructions to reset a lost MySQL root password. I’ve taken these steps from the website “http://www.rackspace.com/knowledge_center/article/mysql-resetting-a-lost-mysql-root-password”. All credit to them. Note that this is done as the ‘root’ user. First stop MySQL and start it in ‘safe mode’: service mysqld stop mysqld_safe –skip-grant-tables & Now login without the

Read more