Created
September 23, 2019 11:50
-
-
Save CHERTS/1dedd7235e96965d38dbe34a16bb8b62 to your computer and use it in GitHub Desktop.
Logging mysql import error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql -u root -p db_name < dumpfilename.sql > /var/tmp/mysqldump.log 2>&1 | |
or create file mysql-import.sh: | |
#!/bin/bash | |
mysql -u root -p'password' -h hostname db_name << EOF | |
CREATE DATABASE dbname; | |
USE dbname; | |
SET foreign_key_checks=0; | |
SOURCE dbdumpname.sql; | |
EOF | |
chmod +x mysql-import.sh | |
./mysql-import.sh > /var/log/mysqldump.log 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment