MAMP MySQL命令行“show database;”不会显示所有数据库

时间:2022-02-23 12:49:15

I'm pretty new to using MAMP as well as PHP and MySQL. When I first installed MAMP on my machine, everything was working fine (connections were made, etc.) and I was able to use the command line to work with MySQL without a problem.

我很擅长使用MAMP以及PHP和MySQL。当我第一次在我的机器上安装MAMP时,一切正常(连接已经完成等)并且我能够使用命令行与MySQL一起工作而没有问题。

Furthermore, when I first started using the command line, I could type the sql command "show databases;" and it listed the three databases that were found on my phpMyAdmin section of MAMP (information_schema, mysql, and performance_schema). I then added my own database to make it four databases and everything was still fine.

此外,当我第一次开始使用命令行时,我可以输入sql命令“show databases;”它列出了我在MAMP的phpMyAdmin部分找到的三个数据库(information_schema,mysql和performance_schema)。然后我添加了自己的数据库,使其成为四个数据库,一切都很好。

However, the last few times I have tried to use the command line and I type "show databases;", it only returns one database: information_schema, and I am unable to access any of the others. But on the phpMyAdmin page, it still shows that there are a total of four databases on my machine. Does anyone know why this is happening and/or how I can get the command line to display all of the databases again in order to make changes to the one I created?

但是,最近几次我尝试使用命令行并输入“show databases;”,它只返回一个数据库:information_schema,我无法访问任何其他数据库。但是在phpMyAdmin页面上,它仍然显示我的机器上总共有四个数据库。有谁知道为什么会发生这种情况和/或如何让命令行再次显示所有数据库以便对我创建的数据库进行更改?

Thanks in advance.

提前致谢。

1 个解决方案

#1


5  

On the command line, use the -u option to indicate which user you want to connect to:

在命令行上,使用-u选项指示要连接到的用户:

mysql -u root -p

mysql -u root -p

Without that, it must be using an anonymous (blank) user with limited rights.

没有它,它必须使用权限有限的匿名(空白)用户。

#1


5  

On the command line, use the -u option to indicate which user you want to connect to:

在命令行上,使用-u选项指示要连接到的用户:

mysql -u root -p

mysql -u root -p

Without that, it must be using an anonymous (blank) user with limited rights.

没有它,它必须使用权限有限的匿名(空白)用户。