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

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


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


3 thoughts on “Clear command doesn’t work for clear the screen in MySQL

  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.

Leave a Reply