We are going to to move the entire MariaDB or Mysql Server – inclusive all users and databases – to a new Server. We don’t have to struggle with mysqldump, we just need tar and ssh.

At first make sure on both machines is installed the same Server version:

server # mysql --version
mysql  Ver 15.1 Distrib 10.3.10-MariaDB, for Linux (x86_64) using readline 5.1

Stop MariaDB/Mysql on both servers:

systemctl stop mariadb

Tar, compress and copy the mysql directory to the server. Copy as a regular user, because root login ist hopefully disabled:

old-server# tar -zcvf database.tar.gz /var/lib/mysql
old-server# scp database.tar.gz user@new-server/tmp

Extract archive on new server and make sure, owner of the new files is the database user:

new-server# tar -xzf /tmp/database.tar.gz -C /
new-server# chown -R mysql:mysql /var/lib/mysql/

The last thing you have to do, is to delete the old log files:

new-server# rm /var/lib/mysql/ib_logfile*

Thats it. Now restart the database server and you are done.

Install packet kernel-tools witch provide cpupower:

dnf install kernel-tools

Read your current CPU governor:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

List available CPU governors:

cpupower frequency-info --governors

Read current CPU frequency:

cpupower frequency-info

Set CPU gorvenor:

cpupower frequency-set --governor powersave

Get random numbers or random words in Linux command line with shuf.

Get a random port number with shuf command:

shuf -n 1 -i 1024-65535

Write it directly into a new variable:

RANDOM_PORT=`shuf -i 1024-65535 -n 1`

Get random word from a word list:

shuf -n 1 /usr/share/dict/words

Download the content of an URL to a file
curl http://example.com/text.txt -o filename.txt

Download the content of a URL and safe it by the given name
curl -O http://example.com/text.txt