10

I'm working with Terminal (Mac OS X), but I think this is a built-in part of Linux. Sometimes, when I execute a command, Terminal returns a new, indented line with just -> on the line. It seems like it's waiting for something, but I don't know if it requires action on my part or not. Pressing enter simply returns another, identical line. When I Ctrl + C, it says Aborted, meaning something was clearly processing. What does this mean? For example, the following:

$ mysql -u root -h host -p
Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is X
Server version: 5.1.39-log MySQL Server

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> mysqldump my_database
    -> 
    -> [Ctrl + C]
    -> Aborted
$

Edit: Seems this is faulty syntax for the command, but I'm not sure that is the reason for the arrows.

4
  • 10
    Actually, OS X is Unix. GNU/Linux is a very similar but not directly related operating system.
    – AndrejaKo
    Jul 5, 2010 at 15:18
  • And in this specific case you probably did NOT want to execute mysql first. Just run mysqldump my_database by itself, outside of the MySQL prompt.
    – Arjan
    Jul 5, 2010 at 18:20
  • 1
    Bash shell will do similar with an unclosed quote.
    – Rob
    Apr 30, 2012 at 18:55
  • → or 👉 look better.
    – Jonny
    May 13, 2015 at 23:53

4 Answers 4

11

In the MySQL command-line tool that means the tool expects your input to continue on the next line. Here it is waiting for the destination path.

Common "full" SQL commands are written with indents, which is supported at the command line. You would say something like

SELECT
    `users`.*
FROM
    `users`
WHERE
    `users`.`is_active` = 1 AND
    `users`.`age` < 13
ORDER BY
    `users`.`username`
2
  • 1
    Great, but how do I get out of "->" ? Semicolon doesn't work.
    – Alkanshel
    Feb 7, 2017 at 18:32
  • 1
    @Amalgovinus try \d ; first Jul 10, 2019 at 14:16
8

The arrows are an interactive continuation prompt. If you enter an unfinished command, the SQL shell (invoked by the mysql command) is waiting for the rest of it.

In this particular case, the SQL shell is waiting for a destination path for the mysqldump.

Also, commands aren't complete until you terminate commands with a semicolon. (Thanks @MrStatic)

3
  • 1
    In this particular case, it's not the shell that's waiting - it's mysql. However, you are otherwise correct. Jul 5, 2010 at 15:53
  • 1
    To add further the way you can tell a command, atleast in mysql, is unfinished you did not end with a ';' Jul 5, 2010 at 16:00
  • @Dennis Sorry for my imprecise wording - Technically, it is a "SQL shell" (see dev.mysql.com/doc/refman/5.1/en/mysql.html) but yes, it's not the bash/zsh unix shell… I will edit my answer.
    – ghoppe
    Jul 5, 2010 at 17:04
3

You do indeed have a syntax error; SQL commands must end with a semicolon. For example:

mysqldump my_database;
0

If you use MariaDB, mysqldump is not a mysql command. Run it in the bash.

$ mysqldump -u root -h host -p ### my_database > dump.sql

To be more exact usage, run mysqldump --help.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .