MySQL Mysql_install_db 找不到文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17601341/
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 18:07:17  来源:igfitidea点击:

Mysql_install_db cannot find file

mysqldatabaseinstall

提问by Learning stats by example

I am trying to use mysql_install_db

我正在尝试使用 mysql_install_db

I am getting the following error:

我收到以下错误:

FATAL ERROR: Could not find ./bin/my_print_defaults

If you compiled from source, you need to run 'make install' to copy the software into the correct location ready for operation.

If you are using a binary release, you must either be at the top level of the extracted archive, or pass the --basedir option pointing to that location.

致命错误:找不到 ./bin/my_print_defaults

如果从源代码编译,则需要运行“make install”以将软件复制到正确的位置以备运行。

如果您使用的是二进制版本,则必须位于解压缩存档的顶层,或者传递指向该位置的 --basedir 选项。

I've tried using

我试过使用

    which my_print_defaults

It returns:

它返回:

    /usr/local/bin/my_print_defaults

So I try the command:

所以我尝试命令:

    mysql_install_db --base-dir=/usr/local/bin/ 

I still receive the same error, though.

不过,我仍然收到同样的错误。

回答by Kelley Robinson

Annoyingly, this just means you have to be in the right directory to execute this. Make sure you're in /usr/local/Cellar/mysql/<version>/before running the script.

令人讨厌的是,这仅意味着您必须在正确的目录中才能执行此操作。/usr/local/Cellar/mysql/<version>/在运行脚本之前确保你在。

回答by Apostle

You must run the command:
# mysql_install_db --basedir=/usr/local
That is without bin. This option must specify a directory path location of the directory ./bin.

您必须运行命令:
# mysql_install_db --basedir=/usr/local
即没有bin. 此选项必须指定目录的目录路径位置./bin

回答by Jamie Andrews

Anyone reading this after installing MySQL with Homebrew may have experienced this issue:

使用 Homebrew 安装 MySQL 后阅读本文的任何人都可能遇到过这个问题:

https://stackoverflow.com/questions/4788381/getting-cant-connect-through-socket-tmp-mysql-when-installing-mysql-on-m

https://stackoverflow.com/questions/4788381/getting-cant-connect-through-socket-tmp-mysql-when-installing-mysql-on-m

And then found their way here after the final instruction didn't work. I simply ran

然后在最终指令不起作用后找到了他们的方式。我只是跑了

mysql.server start

after reading http://benjsicam.me/blog/how-to-install-mysql-on-mac-os-x-using-homebrew-tutorial

阅读后http://benjsicam.me/blog/how-to-install-mysql-on-mac-os-x-using-homebrew-tutorial

Then it all started working miraculously (seems I just hadn't started it?!).

然后这一切开始奇迹般地工作(似乎我还没有开始?!)。

回答by mrded

If you use Brew, try to run mysql_install_dbwith --basedir="$(brew --prefix mariadb)"

如果您使用的Brew,尝试运行mysql_install_db的使用--basedir="$(brew --prefix mariadb)"

Change mariadbto mysqlif you use mysql.

如果您使用mysql ,请更改mariadb为。mysql

回答by avjaarsveld

For me the fix was to point basedir to the actual mysql directory in the cellar, as shown at install.

对我来说,修复方法是将 basedir 指向地窖中的实际 mysql 目录,如安装所示。

eg:

例如:

During installation of mysql (using brew install mysql56), I was shown this path: /usr/local/Cellar/mysql56/5.6.27/bin/mysql_install_db...

在安装mysql(使用brew install mysql56)期间,我看到了这个路径:/usr/local/Cellar/mysql56/5.6.27/bin/mysql_install_db...

I used that to define the basedir like so:

我用它来定义 basedir ,如下所示:

mysql_install_db --verbose --user=`whoami` --basedir="/usr/local/Cellar/mysql56/5.6.27" --datadir=/usr/local/var/mysql --tmpdir=/tmp

回答by shraddheya shrivastava

gotta add the path of mysql installation in system path try: sudo path=${PATH}:/usr/local/mysql/binif you installed mysql in "/usr/local/mysql"

必须在系统路径中添加mysql安装路径试试:sudo path=${PATH}:/usr/local/mysql/bin如果你在“ /usr/local/mysql”中安装了mysql