开发者社区> 问答> 正文

看不到表了, 怎么办:报错

root@iZ22xtlue12:/alidata/www/default/path/to/project# mysql -u root -h localhost -p
Enter password:  (为啥不需要输入密码? 输入密码会报错, 密码肯定对的)
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 351
Server version: 5.5.37-log MySQL Community Server (GPL)

Copyright (c) 2000, 2014, 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> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| test               |
+--------------------+
2 rows in set (0.07 sec)

mysql> exit
Bye

展开
收起
kun坤 2020-06-06 13:46:07 414 0
1 条回答
写回答
取消 提交回答
  • 你是不是更新过mysql了,或者重装过。看起来是配置文件改了,没有访问到原来的数据库路径,而是一个默认位置了。######默认安装完mysql,启动后空密码就可以登录的(但是好像看不到库),启动mysql服务时你会看到一个提示,提示你设置管理员密码(命令是 mysqladmin -u root -p ...之类,记不太清),只有设置了管理员密码才能登录,这时候就不允许空密码登录了。######这个试了还是不行。######去你的data dir下看看。######

    先检查一下root@localhost的权限

    mysql>show grants for 'root'@'localhost';



    可能是localhost和127.0.0.1下root用户权限和密码不一样

    2020-06-06 13:46:13
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载