MySQL 在mysql中,显示数据库;命令没有列出我的所有数据库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9558029/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 12:21:35  来源:igfitidea点击:

In mysql, the show databases; command doesn't list all of my databases

mysql

提问by Jerinos

I can access all of my databases with HeidiSQL, but if I go to the mysql.exe window and use show databases; only 2 of them show up out of 11. These are all databases on 127.0.0.1. Any ideas on why?

我可以使用 HeidiSQL 访问我的所有数据库,但是如果我转到 mysql.exe 窗口并使用 show databases;11 个中只有 2 个出现。这些都是 127.0.0.1 上的数据库。关于为什么的任何想法?

回答by ruakh

You're logging into HeidiSQL as root, so it's showing you all databases, but you're logging into mysql.exeas the current Windows user (since that's the default), so it's only showing you the databases that that user can see. If you run mysql.exewith --user=root --password=..., it will show you all databases.

您以 身份登录 HeidiSQL root,因此它向您显示所有数据库,但您mysql.exe以当前 Windows 用户身份登录(因为这是默认用户),因此它仅向您显示该用户可以看到的数据库。如果运行mysql.exe--user=root --password=...,它会告诉你所有的数据库。

回答by KawaiKx

in my case, SHOW DATABASESor SHOW DATABASES;didn't work.

在我的情况下,SHOW DATABASES或者SHOW DATABASES;没有工作。

what worked is:

有效的是:

show databases;

回答by Ramkailash

I am using Oracle mySql

我正在使用 Oracle mySql

mysql> show databases;

This command show all databases in your SQL server

此命令显示 SQL 服务器中的所有数据库

回答by Olayinka Popoola

First, you have to log in using your username and password before you issue show databases command on cmd. If you request show databases without this, cmd will only show you default databases. your username and password(optional if you username is root) grant you the needed access to the databases. This is my experience and I hope it helps.

首先,在 cmd 上发出 show databases 命令之前,您必须使用您的用户名和密码登录。如果你在没有这个的情况下请求显示数据库,cmd 将只显示你的默认数据库。您的用户名和密码(如果您的用户名是 root 则可选)授予您所需的数据库访问权限。这是我的经验,希望能有所帮助。

回答by jjordan

If you are in a screen session, that can also truncate your results. Just thought I'd throw that out there since that's what my issue was that led me here ---

如果您在屏幕会话中,这也可能会截断您的结果。只是想我会把它扔在那里,因为这就是我的问题导致我来到这里 ---