How to cancel an entry in Terminal

Currently reading the book “Build your own database driven Web site.” It’s been great so far.

I’m trying to enter a bunch of jokes into the database. That’s not a problem. The problem comes when I make a mistake and don’t notice it until I am getting ready to hit enter at the end. From the book, it says to hit “\c” and enter to clear the entry. That does not work. I just get a new “'>” terminal entry. If I try to enter the code, it will not work.

How do I get back to “mysql>” if I make a mistake? I’ve included a screen shot of what I’m talking about. I needed to go back to the first line to change “I’m” to “I\'m”.

i’m sorry i don’t have an answer, but i am curious as to why you are using command line input

wouldn’t you rather use a front end app that is more forgiving?

It’s been a while, but if I remember correctly you need to press ctrl+c to stop entering a query, not \c :slight_smile:

I use SQLyog as my sql gui.

i think you’ll find it a lot more “user friendly” than what you are using for writing and developing sql code. you should be able to use it with the book you are going through.

if you would like to play with it, the community edition is free.


Thanks for all the quick responses.

The only reason I’m using Terminal for this is because the books tells you to use it. I would certainly rather use a front end app for this if it is easier.

I’m very new to PHP and MySQL and that is why I’m reading this book. Would love feedback on a good front end app then. I currently use Coda and CSSEdit for all my web site stuff. I have Espresso and BBEdit also, but don’t use them much. Have to be a Mac client.

I will check out SQLyog.

@ScallioXTX - I will try the ctrl + c when I get home. I’m pretty sure I already tried that and it didn’t work. Did a Google search for answers before I posted here.

If you are using the command line terminal and you find yourself with a ’ or " before the prompt, simply type another one and then you can type \c to exit your command. you’ll still be at the mysql prompt.

another 3rd party GUI to check would be HeidiSQL.

@guelphdad - Thank you so much. That worked perfect. Exactly what I needed. Just wasn’t adding the ’ or " before.

Both HeidiSQL and SQLyog and for Windows only. I’m on a Mac so neither will work. I did find an app called “Sequel Pro” that seems promising. I will play around with it.

Thanks for all the help from everyone. :smiley:

ctrl-U will erase whatever you’ve typed on an input line and let you type something else.