Making a secure MySQL/Maria 5.5+ DB copy

7:28
 
Share
 

Manage episode 190185850 series 1685766
By Discovered by Player FM and our community — copyright is owned by the publisher, not Player FM, and audio streamed directly from their servers.

^Making a secure MySQL/Maria 5.5+ DB copy

after upgrading DB from 5.5 to 10.1.26-MariaDB (as part of debian 8->9 upgrade) run mysql_upgrade

(More) Secure local passwords in MySQL 5.6 and up

Then secure backup;

--------------------------------

!/bin/bash

>

Albert Lombarte

>

Docs: http://www.harecoded.com/copycloneduplicate-mysql-database-script-2184438

>

>

CodyHumpwhistle notes

>

Req: make sure you have MySQL 5.6 or above so you can;

>

First run "mysqlconfigeditor set --user=root --password" first which will created a config file

>

for auto connect with hashed/encrypted? config file (.mylogin.cnf), you can then run mysql without any credentials.

>

>

PRODUCTIONDB=myproduction_db

>

The following database will be DELETED first:

>

COPYDB=prodcopy

>

ERROR=/root/duplicatemysqlerror.log

>

echo "Droping '$COPYDB' and generating it from '$PRODUCTIONDB' dump"

>

mysql -e "drop database $COPYDB;" --force ; mysql -e "create database $COPYDB;" && mysqldump --force --log-error=$ERROR $PRODUCTIONDB | mysql $COPYDB

>

echo "cat'ing the error log file, if no errors below, you're golden..."

>

cat $ERROR

-----------------------



38 episodes available. A new episode about every 8 days averaging 10 mins duration .