简体   繁体   English

通过命令行比phpmyadmin访问其他数据库

[英]Accessing different databases via command line than phpmyadmin

I 've re-installed mysql, uninstalled MAMP. 我已经重新安装了mysql,卸载了MAMP。 So currently I should only have one version of mysql. 所以目前我应该只有一个版本的mysql。 I've done the following: 我已经完成以下工作:

  1. Installed phpmyadmin 安装了phpmyadmin
  2. Created a database 创建一个数据库

I try to import data to it, but the file is too big so I do it via the command line. 我尝试将数据导入其中,但是文件太大,因此我通过命令行进行了处理。 But there I dont see my newly created database, furthermore I see less databases. 但是,在那里我看不到我新创建的数据库,此外,我看到的数据库也更少。 If I do show databases; 如果我show databases; on the command it shows: 在显示的命令上:

information_schema
test

It doesnt show my newly created Database and it doesn`t show other databases that were pre-installed, these are the databases that I see on phpmyadmin: 它不显示我新创建的数据库,也不显示其他预安装的数据库,这些是我在phpmyadmin上看到的数据库:

information_schema
mysql
performance_schema
test
myBBDD->the one I just created and I was looking for to import data via command-line

It seems I have two versions of mysql, but if I stop mysql via command line, I then can't access phpmyadmin so I guess it's the same one, but for some reason I can't access the same databases. 看来我有两个版本的mysql,但是如果我通过命令行停止mysql,则无法访问phpmyadmin,因此我猜它是同一版本,但是由于某种原因,我无法访问相同的数据库。

If you could throw me a bone on this? 如果您能在这件事上给我扔骨头? Im completely lost. 我完全迷路了。

To install mysql and phpmyadmin I've followed this tutorial 要安装mysql和phpmyadmin,请遵循本教程

[EDIT] I tried to delete test and it did dissapear from the command-line too, so it is the same version of MySql, so it must be a permission issue... still investigating [编辑]我试图删除test ,它也从命令行中消失了,因此它是MySql的相同版本,因此它一定是权限问题...仍在调查中

Thanks. 谢谢。

Sounds like you have MAMP's version of MySQL and a standalone MySQL. 听起来您具有MAMP的MySQL版本和独立的MySQL。 See this answer: Access MAMP's MySQL from Terminal 看到这个答案: 从终端访问MAMP的MySQL

Just had the same issue, in my case it turned out to be that I wasn't logging in as the correct user. 只是有同样的问题,以我为例,结果是我没有以正确的用户身份登录。

In the command line, instead of running just mysql , try running mysql -u root -p (replace "root" with whatever user you used in phpMyAdmin to set the databases up). 在命令行中,而不是仅运行mysql ,请尝试运行mysql -u root -p (用在phpMyAdmin中用于设置数据库的任何用户替换“ root”)。 You should then be able to type in the password. 然后,您应该可以输入密码。 Check show databases; 检查show databases; again. 再次。

Just noticed that user Grasshopper in a previous answers' comments was suggesting exactly this, hopefully this will help someone anyway by spelling it out. 刚刚注意到,用户Grasshopper在先前答案的评论中恰恰暗示了这一点,希望这可以通过拼写出点帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM