Mysql: Ignoring query to other database
Posted on | October 20, 2013 | No Comments
Невнятное сообщение Ignoring query to other database на попытку сделать любой show, select в mysql может запросто вывести из себя.
# mysql -Uroot -p
....
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
Ignoring query to other database
или
mysql> show tables;
Ignoring query to other database
Вся проблема в невнимательности или сложившейся привычке работать с postgresql.
В отличии от постгреса в котором флаг -U действительно позволяет указать пользователя от которого мы входим, мускл интерпретирует этот флаг несколько иначе:
–safe-updates, –i-am-a-dummy, -U
Permit only those UPDATE and DELETE statements that specify which
rows to modify by using key values. If you have set this option in
an option file, you can override it by using –safe-updates on the
command line. See the section called “MYSQL TIPS”, for more
information about this option.
При этом в случае с -Uroot мускл не ругается на имя пользователя, т.к. каждая буква этого имени является корректным флагом. Поэтому мы можем войти не подозревая своей ошибки.
# mysql -Usomebody -p
mysql: unknown option '-m'
Синтаксически правильное подключение к бд:
#mysql -uroot -p
Comments
Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/dezhik.ru/wp-includes/class-wp-comment-query.php on line 399