sql-info.de
October 19, 2011

MySQL | "Ignoring query to other database"

A bit of a gotcha maybe, especially if you're used to the PostgreSQL CLI (where -U specifies the user name):

[user@example.com]# mysql -Uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.41-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database some_database;
Ignoring query to other database
mysql> show databases;
Ignoring query to other database
mysql> Bye

Although the connection to MySQL was seemingly successful, any commands only seem to result in the laconic message "Ignoring query to other database". I'm not quite sure why this happens, but -U has the following meaning in MySQL:

  -U, --safe-updates  Only allow UPDATE and DELETE that uses keys.
  -U, --i-am-a-dummy  Synonym for option --safe-updates, -U.

Once again a bit of a head-scratcher which would be helped at the very least by less ambiguous notification messages.

Posted at 1:19 AM

Comments
There is a syntax error in the command :-
#mysql -Uroot -p

Instead of -U, please use -u (small letters)
So the command will be :-
#mysql -uroot -p

It will resolve your concern
Posted by: Rajnesh Siwal | 2011-10-30 20:11
Thank you, but I'm aware there's an "error" - it's the way MySQL make it very unclear what has happened which is causing me to complain.
Posted by: Ian Barwick | 2011-10-30 20:35