找出 MySQL 在 Mac OS X 上的安装位置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16144450/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 17:25:45  来源:igfitidea点击:

Find out where MySQL is installed on Mac OS X

mysqlmacos

提问by weaveoftheride

How do I find out where MySQL is installed on Mac OS X 10.7.9? I have MAMP installed so I presume that it is bundled with this install?

如何找出 MySQL 在 Mac OS X 10.7.9 上的安装位置?我安装了 MAMP,所以我认为它与此安装捆绑在一起?

回答by Raptor

To check MySQL version of MAMP , use the following command in Terminal:

要检查 MAMP 的 MySQL 版本,请在终端中使用以下命令:

/Applications/MAMP/Library/bin/mysql --version

Assume you have started MAMP .

假设您已启动 MAMP 。

Example output:

示例输出:

./mysql  Ver 14.14 Distrib 5.1.44, for apple-darwin8.11.1 (i386) using  EditLine wrapper

UPDATE:Moreover, if you want to find where does mysql installed in system, use the following command:

更新:此外,如果您想查找系统中安装了 mysql 的位置,请使用以下命令:

type -a mysql

type -ais an equivalent of tclsh built-in command wherein OS X bash shell. If MySQL is found, it will show :

type -a相当于whereOS X bash shell 中的 tclsh 内置命令。如果找到 MySQL,它将显示:

mysql is /usr/bin/mysql

If not found, it will show:

如果没有找到,它会显示:

-bash: type: mysql: not found

By default , MySQL is not installed in Mac OS X.

默认情况下,Mac OS X 中未安装 MySQL。

Sidenote:For XAMPP, the command should be:

旁注:对于 XAMPP,命令应该是:

/Applications/XAMPP/xamppfiles/bin/mysql --version

回答by Deb

It will be found in /usr/local/mysqlif you use the mysql binaries or dmg to install it on your system instead of using MAMP

/usr/local/mysql如果您使用 mysql 二进制文件或 dmg 将其安装在您的系统上而不是使用 MAMP ,则会在其中找到它

回答by Jason

If you run SHOW VARIABLESfrom a mysql consoleyou can look for basedir.

如果您SHOW VARIABLESmysql 控制台运行,您可以查找basedir

When I run the following:

当我运行以下命令时:

mysql> SHOW VARIABLES WHERE `Variable_name` = 'basedir';

on my system I get /usr/local/mysqlas the Value returned. (I am not using MAMP - I installed MySQL with homebrew.

在我的系统上,我得到/usr/local/mysql了返回的值。(我没有使用 MAMP - 我用homebrew安装了 MySQL 。

mysqldon my machine is in /usr/local/mysql/binso the basedir is where most everything will be installed to.

mysqld在我的机器上,/usr/local/mysql/bin所以 basedir 是大多数东西都将安装到的地方。

Also util:

也有用:

mysql> SHOW VARIABLES WHERE `Variable_name` = 'datadir'; 

To find where the DBs are stored.

查找存储 DB 的位置。

For more: http://dev.mysql.com/doc/refman/5.0/en/show-variables.html

更多信息:http: //dev.mysql.com/doc/refman/5.0/en/show-variables.html

and http://dev.mysql.com/doc/refman/5.0/en/server-options.html#option_mysqld_basedir

http://dev.mysql.com/doc/refman/5.0/en/server-options.html#option_mysqld_basedir

回答by shnraj

If you downloaded mySQL using a DMG (easiest way to download found here http://dev.mysql.com/downloads/mysql/) in Terminal try: cd /usr/local/

如果您在终端中使用 DMG(最简单的下载方式http://dev.mysql.com/downloads/mysql/)下载了 mySQL ,请尝试:cd /usr/local/

When you type lsyou should see mysql-YOUR-VERSION. You will also see mysql which is the installation directory.

当您键入时,ls您应该看到 mysql-YOUR-VERSION。您还将看到安装目录 mysql。

Source: http://geeksww.com/tutorials/database_management_systems/mysql/installation/how_to_download_and_install_mysql_on_mac_os_x.php

来源:http: //geeksww.com/tutorials/database_management_systems/mysql/installation/how_to_download_and_install_mysql_on_mac_os_x.php

回答by Safa Alai

If you've installed with the dmg, you can also go to the Mac "System Preferences" menu, click on "MySql" and then on the configuration tab to see the location of all MySql directories.

如果你已经安装了 dmg,你也可以进入 Mac 的“系统偏好设置”菜单,点击“MySql”,然后在配置选项卡上查看所有 MySql 目录的位置。

Reference: https://dev.mysql.com/doc/refman/8.0/en/osx-installation-prefpane.html

参考:https: //dev.mysql.com/doc/refman/8.0/en/osx-installation-prefpane.html

回答by anuj pradhan

for me it was installed in /usr/local/opt

对我来说它安装在/usr/local/opt

The command I used for installation is brew install [email protected]

我用于安装的命令是brew install [email protected]

回答by Dzmitry Hubin

Or use good old "find". For example in order to look for old mysql v5.7:

或者使用古老的“查找”。例如为了查找旧的 mysql v5.7:

cd /
find . type -d -name "[email protected]"