Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm SSHing into my headless Ubuntu 11.04 Server using PuTTY, and I'm in a byobu session.

I started a mysql_safe daemon because I was trying to fix a password problem I was having with mysql. I was following this tutorial:

http://myotragusbalearicus.wordpress.com/2011/11/21/mysql-error-1045-28000-access-denied-for-user-rootlocalhost-using-password-no/

The daemon started successfully, and I was able to finish the steps required on another byobu screen, but the screen I was on when I started the daemon is now refusing to accept input in a way that makes any sense to me.

Here's the terminal text:

username@computername:/usr/bin$ sudo mysqld_safe --skip-grant-tables
130427 10:43:53 mysqld_safe Logging to syslog.
130427 10:43:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

/
cd /
ls
exit
^C
^X
exit
help
/h
stop
sudo make me a sandwich

The lines at the bottom were me wildly flailing with every "STOP THIS I DON'T LIKE IT GET ME OUT OF HERE" commands that I could think of, but to no avail. The cursor just sits there mocking me, printing what I type but doing nothing with it. Notice I tried exit twice in case it didn't hear me the first time.

I'm sure I could just close the screen, or the session, or just restart the server, but I'd rather actually understand what's happening. Does it mean something when the prompt just stops listening to you? Is this expected behaviour in this situation?

I'm sure this has a simple answer, but I don't even know what language to use in a search, because I don't know what to call this problem. Feel free to point me to a duplicate, if it exists. Also, if there's a better title for this question, let me know.

I did see this question (Strange thing happening in command prompt), but the answer of going to another session and typing pkill -CONT bash didn't work for me. And even if that had worked, I would have been none the wiser as to what any of it actually means, which is what I'm after here.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

The best way to stop it, is to do this

Open another terminal or another SSH session and then do

ps -eaf | grep -in mysqld

This is what I got from my machine

150:root      5816 31671  0 10:36 pts/4    00:00:00 sudo mysqld
152:mysql     5839  5816  0 10:36 pts/4    00:00:00 mysqld
156:1000      6446  6278  0 10:36 pts/5    00:00:00 grep --color=auto -in mysqld`

Now do

sudo kill -9 5839

Instead of 5839, provide the number which find in your ps -eaf output corresponding to mysqld. This will stop the already running mysqld daemon process.

Now, to start MySql, do it this way

sudo mysqld &

This will start MySql daemon in the background.

EDIT: The mysqld daemon runs an infinite loop, serving incoming requests. When we start it in the foreground, it doesnt respond because it will serve requests through the port only. It will simply ignore all the keyboard inputs. Thats the reason why your terminal doesn't respond to you.

share|improve this answer
    
you'd rather start the daemon with sth like /etc/init.d/mysqld start –  long tom Apr 28 '13 at 21:38
    
I appreciate being given a solution, but it doesn't actually answer the question that was asked. If you look at the bold text in my question, you can see that I was after an explanation of what is happening here, more than a solution. –  Excrubulent Apr 29 '13 at 0:52
    
Perhaps an appropriate answer, inferred from your answer, might be: "You started the daemon in the terminal, but it doesn't respond to command line input, so you're locked out of that terminal. If you start it in the background with /etc/init.d/mysqld start then your terminal will remain available to you." –  Excrubulent Apr 29 '13 at 0:53
    
Updated the answer with the reason –  thefourtheye Apr 29 '13 at 2:01
    
Thanks, accepted. –  Excrubulent Apr 29 '13 at 11:13

Your Answer

 
discard

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.