Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to import a very large MySQL table on remote server. Usually I'm using

mysql -u mysql_user -pMypass db_name < sql_data.sql

But it takes about 5 hours to complete the task. I tried using nohup but the logout process is killing the import. I found that I could use screen, but without any luck.

screen -dmS import_table mysql -u mysql_user -pMypass db_name < sql_data.sql

Please suggest what else I can try. Thanks.

share|improve this question
up vote 2 down vote accepted

Simply invoke screen at a shell prompt. After it's started the shell inside screen, then run the mysql import command as normal. To detach from the screen session, type Ctrl-A, D. To reattach the session, type screen -r

share|improve this answer
It's not as simple as that, mysql commands for many version do not do well with window resizing (like what happens when dettaching a screen) so the process stops with SIGWINCH. – maristgeek Feb 28 '14 at 0:18
As odd as it sounds in another shell before detaching screen you can try killall -WINCH mysql and then detach your screen session.… – maristgeek Feb 28 '14 at 0:20
Nice catch. "tmux" also does everything screen does, and more. – quadruplebucky Feb 28 '14 at 0:55
Thanks @John. I eventually used byobu, so your advise helped a lot! – valk Mar 1 '14 at 19:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.