您应牢记以下问题和注意事项:You should keep the following issues and notes in mind:
其他 MySQL 安装:安装过程无法识别由 Homebrew 等软件包管理器安装的 MySQL。安装和升级过程是针对我们提供的 MySQL 软件包。如果存在其他安装,请考虑在执行此安装程序之前停止它们,以避免端口冲突。Other MySQL installations: The installation procedure does not recognize MySQL installations by package managers such as Homebrew. The installation and upgrade process is for MySQL packages provided by us. If other installations are present, then consider stopping them before executing this installer to avoid port conflicts.
Homebrew:例如,如果您使用 Homebrew 将 MySQL Server 安装到其默认位置,则 MySQL 安装程序将安装到其他位置,并且不会从 Homebrew 升级版本。在这种情况下,您最终会安装多个 MySQL,默认情况下,它们会尝试使用相同的端口。在运行此安装程序之前停止其他 MySQL Server 实例,例如执行 brew services stop mysql 来停止 Homebrew 的 MySQL 服务。Homebrew: For example, if you installed MySQL Server using Homebrew to its default location then the MySQL installer installs to a different location and won't upgrade the version from Homebrew. In this scenario you would end up with multiple MySQL installations that, by default, attempt to use the same ports. Stop the other MySQL Server instances before running this installer, such as executing brew services stop mysql to stop the Homebrew's MySQL service.
Launchd:安装了一个 launchd 守护进程,它会更改 MySQL 配置选项。如果需要,请考虑对其进行编辑,请参阅下面的文档以获取更多信息。此外,macOS 10.10 删除了启动项支持,转而支持 launchd 守护进程。 macOS 系统偏好设置下的可选 MySQL 偏好设置窗格使用 launchd 守护进程。Launchd: A launchd daemon is installed that alters MySQL configuration options. Consider editing it if needed, see the documentation below for additional information. Also, macOS 10.10 removed startup item support in favor of launchd daemons. The optional MySQL preference pane under macOS System Preferences uses the launchd daemon.
用户:您可能需要(或想要)创建特定的
mysql用户来拥有 MySQL 目录和数据。您可以通过目录实用程序执行此操作,并且mysql用户应该已经存在。要在单用户模式下使用,系统/etc/passwd文件中应已存在_mysql条目(注意下划线前缀)。Users: You may need (or want) to create a specificmysqluser to own the MySQL directory and data. You can do this through the Directory Utility, and themysqluser should already exist. For use in single user mode, an entry for_mysql(note the underscore prefix) should already exist within the system/etc/passwdfile.数据:由于 MySQL 软件包安装程序将 MySQL 内容安装到特定于版本和平台的目录中,因此您可以使用它在版本之间升级和迁移数据库。您需要将
data目录从旧版本复制到新版本,或者指定替代的datadir值来设置数据目录的位置。默认情况下,MySQL 目录安装在/usr/local/下。Data: Because the MySQL package installer installs the MySQL contents into a version and platform specific directory, you can use this to upgrade and migrate your database between versions. You need either to copy thedatadirectory from the old version to the new version, or to specify an alternativedatadirvalue to set location of the data directory. By default, the MySQL directories are installed under/usr/local/.别名:您可能需要向 shell 的资源文件添加别名,以便更轻松地访问常用程序,例如 mysql 和 mysqladmin 从命令行。 bash 的语法是:Aliases: You might want to add aliases to your shell's resource file to make it easier to access commonly used programs such as mysql and mysqladmin from the command line. The syntax for bash is:
alias mysql=/usr/local/mysql/bin/mysql alias mysqladmin=/usr/local/mysql/bin/mysqladmin
对于 tcsh,请使用:For tcsh, use:
alias mysql /usr/local/mysql/bin/mysql alias mysqladmin /usr/local/mysql/bin/mysqladmin
更好的是,将
/usr/local/mysql/bin添加到PATH环境变量中。您可以通过修改 shell 的适当启动文件来完成此操作。有关详细信息,请参阅第 6.2.1 节“调用 MySQL 程序”。Even better, add/usr/local/mysql/binto yourPATHenvironment variable. You can do this by modifying the appropriate startup file for your shell. For more information, see Section 6.2.1, “Invoking MySQL Programs”.删除:在复制了先前安装的 MySQL 数据库文件并成功启动新服务器后,您应该考虑删除旧的安装文件以保存磁盘空间。此外,您还应该删除位于
/Library/Receipts/mysql-中的旧版本 Package Receipt 目录。Removing: After you have copied over the MySQL database files from the previous installation and have successfully started the new server, you should consider removing the old installation files to save disk space. Additionally, you should also remove older versions of the Package Receipt directories located inVERSION.pkg/Library/Receipts/mysql-.VERSION.pkg