Clear command doesn’t work for clear the screen in MySQL

I was very much confused when I have tried to clear the screen of MySQL and I didn’t got any result.

root@nilnandan-Satellite-A200:~# mysql -uroot -p
Enter password:
Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement.
mysql> show databases;
+——————–+
| Database           |
+——————–+
| information_schema |
| mysql              |
+——————–+
2 rows in set (0.28 sec)
mysql> clear
mysql> clear
mysql>

I thought, clear command will work same in MySQL which it works for Windows or Linux OS. But no..In MySQL this command is doing something different.

When I checked through help command, I found following thing.

clear     (c) Clear the current input statement.

I don’t know how and what it clears but after goggling a lot I found following commands to clear the screen in MySQL. I guess this is not the actual command but workaround. Btw: Its using system (OS) command in MySQL.

On Linux, we can use below command:

mysql>system clear

OR

mysql>! clear (here, there is a space between ! and clear)

 

Readers Comments (8)

  1. “mysql>system cls;” command does’t work in windows. instead it throwing error like,

    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
    corresponds to your MySQL server version for the right syntax to use near ‘syste
    m cls’ at line 1

  2. Hi Thiyagu,

    Thanks for pointing out. System command is only for linux to run shell commands so it will not work with Windows.
    Post updated.

  3. thank s a lot yar
    it worked in mysql
    i also struggled to verify

  4. Ctrl + L works for me. it’s less to type too.
    i’m running mysql 5.5 on ubuntu 14.04

  5. Ctrl + L or ! clear (system clear)

  6. wt is screen clear command for windows?

  7. no none of the commands are working….all commands are showing error pls help me..my sql version is5.5.46 (command line client)
    mysql> screen clear
    -> screen clear;
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
    corresponds to your MySQL server version for the right syntax to use near ‘screen clear’

    • Hi Mahi,

      Please check above post, command is “system clear” not “screen clear”. Please try to use “system clear” again and let me know. I already checked and its working.

Leave a comment

Your email address will not be published.


*