SQL: Import mysql db to external HDD

# Create the database
sudo mysql -e "CREATE DATABASE invitrodb_v4_3;"

# Verify that a data folder has been created
sudo ls -ld /var/lib/mysql/invitrodb_v4_3

# Stop the server
sudo systemctl stop mysql

# Move the newly created directory from the main drive to the external drive
sudo mv /var/lib/mysql/invitrodb_v4_3 /data/mysql/

# Create the symbolic link in its place
sudo ln -s /data/mysql/invitrodb_v4_3 /var/lib/mysql/invitrodb_v4_3

# Start the server
sudo systemctl start mysql

# Determine import file size
stat -c%s invitrodb_v4_3.sql
97495335333

# Import the database, ensuring no binlog (slows larger imports) and passinbg filesize to pipe viewer for accurate ETA calculation

(echo "SET sql_log_bin = 0;"; cat invitrodb_v4_3.sql) | pv -s 97495335333 | mysql -u toxlab -p invitrodb_v4_3

"Life does not start and stop at your convenience, you miserable piece of shit"