如何在Leopard,Mac OS X 10.5上安装MySQL?

时间:2022-12-12 07:15:34

I followed this tutorial to the very end, then found out it didn't work right. I think I have everything installed but when I type

我跟着这个教程到最后,然后发现它不能正常工作。我想我已经安装了所有东西,但是当我输入时

mysql -uroot

I only get

我得到了

-bash: mysql: command not found

Note: I did not skip the "Setting the Path" step. Upon running this command for the first time:

注意:我没有跳过“设置路径”步骤。首次运行此命令时:

mate ~/.bash_login

This brought up an empty file. So I added this line:

这带来了一个空文件。所以我添加了这一行:

export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"

I saved the file, closed TextMate, executed the following command:

我保存文件,关闭TextMate,执行以下命令:

. ~/.bash_login

...and continued with the tutorial. Based on your suggestions, I thought maybe the file didn't actually get saved. So I ran the following command to bring up the file again:

...继续学习本教程。根据你的建议,我想也许文件实际上没有得到保存。所以我运行以下命令再次调出文件:

mate ~/.bash_login

...yet the contents of the file were as they should be.

......但文件的内容应该是应有的。

Any suggestions?

6 个解决方案

#1


You probably don't have the mysql binaries in your path.

你的路径中可能没有mysql二进制文件。

The link you posted has a section on setting the path, titled "Setting the Path Do not skip this step! Most everything else will fail if you do."

您发布的链接有一个关于设置路径的部分,标题为“设置路径不要跳过此步骤!如果您这样做,其他所有内容都将失败”。

EDIT: As debugging steps, try:

编辑:作为调试步骤,尝试:

  • First launching a new terminal window. Does it run now?
  • 首先启动一个新的终端窗口。它现在运行吗?

  • Typing "echo $PATH" at the prompt. Does the path show up correctly as you've typed it in bash_profile?
  • 在提示符下键入“echo $ PATH”。您在bash_profile中输入路径时路径是否正确显示?

  • Running it the long way: /usr/local/mysql/bin/mysql -u root Does the application run?
  • 运行它很长的路:/ usr / local / mysql / bin / mysql -u root应用程序运行吗?

#2


Did you follow the step that says

你有没有按照说的那样做

Setting the Path

设置路径

Do not skip this step! Most everything else will fail if you do.

不要跳过此步骤!如果你这样做,其他大部分都会失败。

Did you close your terminal window and re-open it afterwards?

您是否关闭了终端窗口并在之后重新打开它?

Update: What does "which mysql" say? Does "ls /usr/local/mysql/bin" say?

更新:“哪个mysql”说什么? “ls / usr / local / mysql / bin”会说吗?

#3


Two things:

  • Try editing ~/.profile (rather than ~/.bash_profile or ~/.bash_login).
  • 尝试编辑〜/ .profile(而不是〜/ .bash_profile或〜/ .bash_login)。

  • You may find it easier to use the native Mac style .dmg installer directly from Sun.
  • 您可能会发现直接从Sun使用本机Mac风格的.dmg安装程序更容易。

One nice thing about the dmg installer is that it automagically sets up symlinks to /usr/local/mysql (which means less - or no - fiddling with your $PATH).

关于dmg安装程序的一个好处是它自动将符号链接设置为/ usr / local / mysql(这意味着更少 - 或者没有 - 摆弄你的$ PATH)。

#4


Another option would be to use MAMP.

另一种选择是使用MAMP。

It has Apache, PHP and MySQL packaged with no further setup necessary.

它包含Apache,PHP和MySQL,无需进一步设置。

#5


MySQL is usually put in /usr/local/mysql/bin/

MySQL通常放在/ usr / local / mysql / bin /

You need to add this to your PATH, you can do this by adding the follwoing lines to your .bash_profile

你需要将它添加到你的PATH,你可以通过将以下行添加到.bash_profile来实现

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

The .bash_profile file is located in the root of your username directory.

.bash_profile文件位于用户名目录的根目录中。

Make sure you restart your Terminal for the setting to take affect.

确保重新启动终端以使设置生效。

#6


And if you're not a command-line person, I highly recommend you also install the MySQL Preference Pane to start/stop the server and install Sequel Pro to create databases and run queries.

如果您不是命令行,我强烈建议您也安装MySQL Preference窗格来启动/停止服务器并安装Sequel Pro来创建数据库并运行查询。

ftp://ftp.mysql.com/pub/mysql/download/gui-tools/MySQL.prefPane-leopardfix.zip

http://www.sequelpro.com/

#1


You probably don't have the mysql binaries in your path.

你的路径中可能没有mysql二进制文件。

The link you posted has a section on setting the path, titled "Setting the Path Do not skip this step! Most everything else will fail if you do."

您发布的链接有一个关于设置路径的部分,标题为“设置路径不要跳过此步骤!如果您这样做,其他所有内容都将失败”。

EDIT: As debugging steps, try:

编辑:作为调试步骤,尝试:

  • First launching a new terminal window. Does it run now?
  • 首先启动一个新的终端窗口。它现在运行吗?

  • Typing "echo $PATH" at the prompt. Does the path show up correctly as you've typed it in bash_profile?
  • 在提示符下键入“echo $ PATH”。您在bash_profile中输入路径时路径是否正确显示?

  • Running it the long way: /usr/local/mysql/bin/mysql -u root Does the application run?
  • 运行它很长的路:/ usr / local / mysql / bin / mysql -u root应用程序运行吗?

#2


Did you follow the step that says

你有没有按照说的那样做

Setting the Path

设置路径

Do not skip this step! Most everything else will fail if you do.

不要跳过此步骤!如果你这样做,其他大部分都会失败。

Did you close your terminal window and re-open it afterwards?

您是否关闭了终端窗口并在之后重新打开它?

Update: What does "which mysql" say? Does "ls /usr/local/mysql/bin" say?

更新:“哪个mysql”说什么? “ls / usr / local / mysql / bin”会说吗?

#3


Two things:

  • Try editing ~/.profile (rather than ~/.bash_profile or ~/.bash_login).
  • 尝试编辑〜/ .profile(而不是〜/ .bash_profile或〜/ .bash_login)。

  • You may find it easier to use the native Mac style .dmg installer directly from Sun.
  • 您可能会发现直接从Sun使用本机Mac风格的.dmg安装程序更容易。

One nice thing about the dmg installer is that it automagically sets up symlinks to /usr/local/mysql (which means less - or no - fiddling with your $PATH).

关于dmg安装程序的一个好处是它自动将符号链接设置为/ usr / local / mysql(这意味着更少 - 或者没有 - 摆弄你的$ PATH)。

#4


Another option would be to use MAMP.

另一种选择是使用MAMP。

It has Apache, PHP and MySQL packaged with no further setup necessary.

它包含Apache,PHP和MySQL,无需进一步设置。

#5


MySQL is usually put in /usr/local/mysql/bin/

MySQL通常放在/ usr / local / mysql / bin /

You need to add this to your PATH, you can do this by adding the follwoing lines to your .bash_profile

你需要将它添加到你的PATH,你可以通过将以下行添加到.bash_profile来实现

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

The .bash_profile file is located in the root of your username directory.

.bash_profile文件位于用户名目录的根目录中。

Make sure you restart your Terminal for the setting to take affect.

确保重新启动终端以使设置生效。

#6


And if you're not a command-line person, I highly recommend you also install the MySQL Preference Pane to start/stop the server and install Sequel Pro to create databases and run queries.

如果您不是命令行,我强烈建议您也安装MySQL Preference窗格来启动/停止服务器并安装Sequel Pro来创建数据库并运行查询。

ftp://ftp.mysql.com/pub/mysql/download/gui-tools/MySQL.prefPane-leopardfix.zip

http://www.sequelpro.com/