Skip to content

Instantly share code, notes, and snippets.

@nimdasx
Created May 30, 2024 13:36
Show Gist options
  • Save nimdasx/ca578fe2ac3cbb9bc37c07f591827452 to your computer and use it in GitHub Desktop.
Save nimdasx/ca578fe2ac3cbb9bc37c07f591827452 to your computer and use it in GitHub Desktop.
mysql-restore.sh
read -p "nama file : " nama_file
read -p "nama db : " nama_db
host=0.0.0.0
user=root
pass=xxx
port=3306
echo "
CREATE DATABASE ${nama_db}
CHARACTER SET utf8mb4
COLLATE utf8mb4_general_ci;
" | mysql -u$user -p$pass -P$port -h$host
pv $nama_file | mysql $nama_db -h$host -P$port -u$user -p$pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment