Reputation: 190
I am using mysql command responses in my script
When database connection was lost, MySQL would fail to response queries & at that time MySQL error will be shown in command prompt like
mysql -u root TEST -e "show tables"
ERROR 2003 (HY000): Can't connect to MySQL server on 'X.X.X.X' (111)
I am in-need to hide that MySQL error from command prompt when i execute the query.
Upvotes: 1
Views: 2448
Reputation: 781761
Redirect standard error, just like you would any other command if you don't want to see errors.
mysql -u root TEST -e "show tables" 2>/dev/null
If you also want to hide the normal output, redirect standard output as well:
mysql -u root TEST -e "show tables" >/dev/null 2>&1
Upvotes: 3
Reputation: 4506
You can try "\! clear" , it will execute clear shell command."\!" is used to execute shell command.
mysql> \! clear
in *nix it will clear your command prompt.
Upvotes: 0