Mysql错误:Ignoring query to other database解决方法
今天登陆mysql show databases出现Ignoring query to other database错误,又试了几个命令和sql全部提示Ignoring query to other database错误
错误如下:
[root@vps ~]# mysql -hlocalhost -root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2267
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
Ignoring query to other database
mysql> show tables;
Ignoring query to other database
折腾了半天才发现原来是在连接mysql时没有"-u"参数导致的
[root@vps ~]# mysql -hlocalhost -root -p
重新连接mysql 加上-u参数 一且正常
[root@vps ~]# mysql -hlocalhost -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2291
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| dataxxx1 |
| dataxxx2 |
| dataxxx3 |
| dataxxx4 |
| mysql |
| test |
+--------------------+
13 rows in set (0.15 sec)