MySQL 表未显示在 phpMyAdmin 和 MySQLWorkbench 中

OHL*_*ÁLÁ 7 mysql phpmyadmin mysql-workbench

我刚刚设置了 phpMyAdmin,但遇到了这个问题:登录时,我看不到任何表格。

我曾在 MySQLWorkbench 上尝试过这个,但得到了相同的结果。

有什么建议 ?

Rol*_*DBA 4

运行这些命令完全是同义的:

SHOW TABLES;
SELECT table_name FROM information_schema.tables where table_schema = DATABASE();
Run Code Online (Sandbox Code Playgroud)

在幕后,这两个命令只会检查当前所选数据库中是否存在 .frm 文件。

在 MySQLWorkbench 中,您必须确保选择了默认架构。否则,您不应该得到任何回报。从 mysql 客户端的角度来看,实际发生的情况如下:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.5.12-log MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> select database();
+------------+
| database() |
+------------+
| NULL       |
+------------+
1 row in set (0.00 sec)

mysql> show tables;
ERROR 1046 (3D000): No database selected
mysql> SELECT table_name FROM information_schema.tables where table_schema = DATABASE();
Empty set (0.00 sec)

mysql>
Run Code Online (Sandbox Code Playgroud)

在 MySQLWorkbench 中尝试以下操作:

  • 在主窗口的“服务器管理”(右侧)下,单击“管理服务器实例”
  • 在左侧的“服务器实例”列表框中,选择一个服务器实例
  • 单击“编辑所选...”按钮
  • 在“参数”选项卡中,最后一个编辑字段标记为“默认架构:”
  • 确保在该字段中输入数据库名称。出于测试目的,请使用“information_schema”(首选)或“mysql”。

完成这些步骤后,所选数据库应该可见。

试一试 !!!