Last active
September 23, 2019 11:52
-
-
Save CHERTS/ba66ba63b3a5d73841b7f37133c3e33f to your computer and use it in GitHub Desktop.
Logging mysql import error
This file contains 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
1) Run: | |
mysql -u root -p db_name < dumpfilename.sql > /var/tmp/mysqldump.log 2>&1 | |
2) 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