在计算机上的任何地方都找不到MySQL [英] MySQL is not found anywhere on computer

查看:202
本文介绍了在计算机上的任何地方都找不到MySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近直接从网站(mysql-5.7.9-osx10.10-x86_64.dmg)安装了MySQL,从尝试更改给定密码开始,我遇到了很多困难.返回的错误是:

I have recently installed MySQL directly from the website (mysql-5.7.9-osx10.10-x86_64.dmg) and I have run into a great deal of difficulty that started with trying to change the given password. The error that was returned was:

[警告]可以在命令行界面上使用密码 不安全. mysqladmin:连接到"localhost"服务器失败错误: 无法通过套接字'/tmp/mysql.sock连接到本地MySQL服务器 (2)'检查mysqld是否正在运行以及套接字: '/tmp/mysql.sock'存在!

[Warning] Using a password on the command line interface can be insecure. mysqladmin: connect to server at 'localhost' failed error: Can't connect to local MySQL server through socket '/tmp/mysql.sock (2)' Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!

在这里,我试图找到"usr"文件夹(正在显示隐藏的文件),甚至在我的计算机上的任何地方都找不到类似于MySQL的东西,除了安装.dmg文件之外什么都没有.

From here I attempted to find the "usr" folder (hidden files are showing) or even anything that closely resembles MySQL anywhere on my computer and got nothing except for installation .dmg files.

我知道已经安装了MySQL,因为它现在可以在系统偏好设置"窗格中启动和停止,但是显然我的任何命令都无法正常工作,无论我做什么,我都会不断收到此错误:

I know that MySQL was installed because it is now able to be started and stopped in the System Preferences pane, but clearly none of my commands are working and I keep getting this error no matter what I do:

mysql: command not found

有人可以给我一些有关我失踪的线索吗?我变得非常绝望,无法弄清楚我在做什么错.我正在运行El Capitan.

Can someone give me some clue as to what I am missing? I've become fairly desperate and can't figure out what I am doing wrong. I am running El Capitan.

推荐答案

好吧,如果您说MySQL正在运行,则可以尝试通过这样的终端命令来查找它:

Well, if you're saying that MySQL is running, you can try looking for it via terminal command like this:

ps aux | grep mysql

应该给出类似的内容

12345 ... 5 Apr16 9:09.32 /usr/local/Cellar/mysql/5.6.17/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.6.17 --datadir=/usr/local/var/mysql --bind-address=127.0.0.1 

因此,basedir和datadir可能是此处最有价值的输出(请注意,您的路径很可能会有所不同).

so basedir and datadir is probably the most valuable outputs here (please note that your path most likely will be different).

最重要的是,为了使mysql命令通过终端运行,您有两个选择

On top of it, in order to get mysql command running through terminal you have two options

  1. 从mysql的baseir创建simulink到您的/usr/local/bin目录

  1. Create simulink from mysql's basedir into your /usr/local/bin directory

ln -s /usr/local/Cellar/mysql/5.6.17/bin/mysql /usr/local/bin/mysql

将mysql的basedir/bin添加到您的路径(需要将其添加到〜/.bashrc中以使其持久)

Add mysql's basedir/bin to your path (need to add this to your ~/.bashrc to make it persistent)

export PATH=/usr/local/Cellar/mysql/5.6.17/bin/:$PATH

需要新的终端标签才能使这些更改赶上来.

New terminal tab is required for these changes to catch up.

干杯.

这篇关于在计算机上的任何地方都找不到MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆