mysql在mac下安装与配置

本文涉及的产品
RDS DuckDB + QuickBI 企业套餐,8核32GB + QuickBI 专业版
RDS AI 助手,专业版
RDS Agent(兼容OpenClaw),2核4GB
简介:
2.4.10 Installing MySQL on Mac OS X
-----------------------------------

You can install MySQL on Mac OS X 10.3.x (`Panther') or newer using a
Mac OS X binary package in PKG format instead of the binary tarball
distribution. Please note that older versions of Mac OS X (for example,
10.1.x or 10.2.x) are *not* supported by this package.

The package is located inside a disk image (`.dmg') file that you first
need to mount by double-clicking its icon in the Finder. It should then
mount the image and display its contents.

To obtain MySQL, see *Note getting-mysql::.

*Note*: Before proceeding with the installation, be sure to shut down
all running MySQL server instances by either using the MySQL Manager
Application (on Mac OS X Server) or via `mysqladmin shutdown' on the
command line.

To actually install the MySQL PKG file, double-click on the package
icon. This launches the Mac OS X Package Installer, which guides you
through the installation of MySQL.

Due to a bug in the Mac OS X package installer, you may see this error
message in the destination disk selection dialog:

     You cannot install this software on this disk. (null)

If this error occurs, simply click the `Go Back' button once to return
to the previous screen. Then click `Continue' to advance to the
destination disk selection again, and you should be able to choose the
destination disk correctly. We have reported this bug to Apple and it is
investigating this problem.

The Mac OS X PKG of MySQL installs itself into
`/usr/local/mysql-VERSION' and also installs a symbolic link,
`/usr/local/mysql', that points to the new location. If a directory
named `/usr/local/mysql' exists, it is renamed to
`/usr/local/mysql.bak' first. Additionally, the installer creates the
grant tables in the `mysql' database by executing `mysql_install_db'.

The installation layout is similar to that of a `tar' file binary
distribution; all MySQL binaries are located in the directory
`/usr/local/mysql/bin'. The MySQL socket file is created as
`/tmp/mysql.sock' by default. See *Note installation-layouts::.

MySQL installation requires a Mac OS X user account named `mysql'. A
user account with this name should exist by default on Mac OS X 10.2
and up.

If you are running Mac OS X Server, a version of MySQL should already
be installed. The following table shows the versions of MySQL that ship
with Mac OS X Server versions.

*Mac OS X Server       *MySQL Version*
Version*               
10.2-10.2.2            3.23.51
10.2.3-10.2.6          3.23.53
10.3                   4.0.14
10.3.2                 4.0.16
10.4.0                 4.1.10a

This manual section covers the installation of the official MySQL Mac
OS X PKG only. Make sure to read Apple's help information about
installing MySQL: Run the `Help View' application, select `Mac OS X
Server' help, do a search for `MySQL,' and read the item entitled
`Installing MySQL.'

For preinstalled versions of MySQL on Mac OS X Server, note especially
that you should start `mysqld' with `safe_mysqld' instead of
`mysqld_safe' if MySQL is older than version 4.0.

If you previously used Marc Liyanage's MySQL packages for Mac OS X from
`[url]http://www.entropy.ch[/url]', you can simply follow the update instructions
for packages using the binary installation layout as given on his pages.

If you are upgrading from Marc's 3.23.x versions or from the Mac OS X
Server version of MySQL to the official MySQL PKG, you also need to
convert the existing MySQL privilege tables to the current format,
because some new security privileges have been added. See *Note
mysql-upgrade::.

If you want MySQL to start automatically during system startup, you
also need to install the MySQL Startup Item. It is part of the Mac OS X
installation disk images as a separate installation package. Simply
double-click the `MySQLStartupItem.pkg' icon and follow the
instructions to install it. The Startup Item need be installed only
once. There is no need to install it each time you upgrade the MySQL
package later.

The Startup Item for MySQL is installed into
`/Library/StartupItems/MySQLCOM'. (Before MySQL 4.1.2, the location was
`/Library/StartupItems/MySQL', but that collided with the MySQL Startup
Item installed by Mac OS X Server.) Startup Item installation adds a
variable `MYSQLCOM=-YES-' to the system configuration file
`/etc/hostconfig'. If you want to disable the automatic startup of
MySQL, simply change this variable to `MYSQLCOM=-NO-'.

On Mac OS X Server, the default MySQL installation uses the variable
`MYSQL' in the `/etc/hostconfig' file. The MySQL AB Startup Item
installer disables this variable by setting it to `MYSQL=-NO-'. This
avoids boot time conflicts with the `MYSQLCOM' variable used by the
MySQL AB Startup Item. However, it does not shut down a running MySQL
server. You should do that yourself.

After the installation, you can start up MySQL by running the following
commands in a terminal window. You must have administrator privileges
to perform this task.

If you have installed the Startup Item, use this command:

     shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
     (ENTER YOUR PASSWORD, IF NECESSARY)
     (PRESS CONTROL-D OR ENTER "EXIT" TO EXIT THE SHELL)

If you don't use the Startup Item, enter the following command sequence:

     shell> cd /usr/local/mysql
     shell> sudo ./bin/mysqld_safe
     (ENTER YOUR PASSWORD, IF NECESSARY)
     (PRESS CONTROL-Z)
     shell> bg
     (PRESS CONTROL-D OR ENTER "EXIT" TO EXIT THE SHELL)

You should be able to connect to the MySQL server, for example, by
running `/usr/local/mysql/bin/mysql'.

*Note*: The accounts that are listed in the MySQL grant tables
initially have no passwords.  After starting the server, you should set
up passwords for them using the instructions in *Note
post-installation::.

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

For `tcsh', use:

     alias mysql /usr/local/mysql/bin/mysql
     alias mysqladmin /usr/local/mysql/bin/mysqladmin

Even better, add `/usr/local/mysql/bin' to your `PATH' environment
variable. You can do this by modifying the appropriate startup file for
your shell. For more information, see *Note invoking-programs::.

If you are upgrading an existing installation, note that installing a
new MySQL PKG does not remove the directory of an older installation.
Unfortunately, the Mac OS X Installer does not yet offer the
functionality required to properly upgrade previously installed
packages.

To use your existing databases with the new installation, you'll need
to copy the contents of the old data directory to the new data
directory. Make sure that neither the old server nor the new one is
running when you do this. 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 in
`/Library/Receipts/mysql-VERSION.pkg'.

File: manual.info,  Node: solaris-installation,  Next: installation-i5os,  Prev: mac-os-x-installation,  Up: installing-cs

2.4.11 Installing MySQL on Solaris
----------------------------------

If you install MySQL using a binary tarball distribution on Solaris,
you may run into trouble even before you get the MySQL distribution
unpacked, as the Solaris `tar' cannot handle long filenames. This means
that you may see errors when you try to unpack MySQL.

If this occurs, you must use GNU `tar' (`gtar') to unpack the
distribution. You can find a precompiled copy for Solaris at
`[url]http://dev.mysql.com/downloads/os-solaris.html[/url]'.

You can install MySQL on Solaris using a binary package in PKG format
instead of the binary tarball distribution. Before installing using the
binary PKG format, you should create the `mysql' user and group, for
example:

     groupadd mysql
     useradd -g mysql mysql

Some basic PKG-handling commands follow:

   * To add a package:

          pkgadd -d PACKAGE_NAME.pkg

   * To remove a package:

          pkgrm PACKAGE_NAME

   * To get a full list of installed packages:

          pkginfo

   * To get detailed information for a package:

          pkginfo -l PACKAGE_NAME

   * To list the files belonging to a package:

          pkgchk -v PACKAGE_NAME

   * To get packaging information for an arbitrary file:

          pkgchk -l -p FILE_NAME

For additional information about installing MySQL on Solaris, see *Note
solaris::.

File: manual.info,  Node: installation-i5os,  Next: netware-installation,  Prev: solaris-installation,  Up: installing-cs

2.4.12 Installing MySQL on i5/OS
--------------------------------

The i5/OS POWER MySQL package was created in cooperation with IBM.
MySQL works within the Portable Application Solution Environment (PASE)
on the System i series of hardware and will also provide database
services for the Zend Core for i5/OS.

MySQL for i5/OS is provided as a save file (`.savf') package that can
be downloaded and installed directly without any additional
installation steps required.

MySQL is only supported on i5/OS V5R4 or later releases. The i5/OS PASE
must be installed for MySQL to operate. You must be able to login as a
user in `*SECOFR' class.

You should the installation notes and tips for i5/OS before starting
installation. See *Note installation-i5os-notes::.

*Note*:

The installation package will use an existing configuration if you have
previously installed MySQL. The values for the data directory
(`DATADIR') and owner of the MySQL files (`USRPRF') specified during the
installation will be ignored, and the values determined from the
`/etc/my.cnf' will be used instead.

If you want to change these parameters during a new install, you should
temporarily rename `/etc/my.cnf', install MySQL using the new
parameters you want to use, and then merge your previous `/etc/my.cnf'
configuration settings with the new `/etc/my.cnf' file that is created
during installation.

To install MySQL on i5/OS, follow these steps:

  1. Create a user profile `MYSQL'. The `MYSQL' user profile will own
     all the MySQL files and databases and be the active user used when
     the MySQL server is running. The profile should be disabled so
     that you cannot log in as the MySQL user. To create a user
     profile, use `CRTUSRPRF':

          CRTUSRPRF USRPRF(MYSQL) STATUS(*DISABLED) TEXT('MySQL user id')

  2. On the System i machine, create a save file that will be used to
     receive the downloaded installation save file. The file should be
     located within the General Purpose Library (`QGPL'):

          CRTSAVF FILE(QGPL/MYSQLINST)

  3. Download the MySQL installation save file in 32-bit
     (`mysql-5.0.42-i5os-power-32bit.savf') or 64-bit
     (`mysql-5.0.42-i5os-power-64bit.savf') from MySQL Downloads
     ([url]http://dev.mysql.com/downloads[/url]).

  4. You need to FTP the downloaded `.savf' file directly into the
     `QGPL/MYSQLINST' file on the System i server. You can do this
     through FTP using the following steps after logging in to the
     System i machine:

          ftp> bin
          ftp> cd qgpl
          ftp> put mysql-5.0.42-i5os-power.savf mysqlinst

  5. Log into the System i server using a user in the `*SECOFR' class,
     such as the `QSECOFR' user ID.

  6. You need to restore the installation library stored in the `.savf'
     save file:

          RSTLIB MYSQLINST DEV(*SAVF) SAVF(QGPL/MYSQLINST)

  7. You need to execute the installation command,
     `MYSQLINST/INSMYSQL'. You can specify three parameter settings
     during installation:

        * `DIR('/OPT/MYSQL')' sets the installation location for the
          MySQL files. The directory will be created if it does not
          already exist.

        * `DATADIR('/QOPENSYS/MYSAL/DATA')' sets the location of the
          directory that will be used to store the database files and
          binary logs. The default setting is `/QOpenSys/mysql/data'.

        * `USRPRF(MYSQL)' sets the user profile that will own the files
          that are installed. The profile will be created if it does not
          already exist.

     MySQL can be installed anywhere, for this example we will assume
     MySQL has been installed into `/opt/mysql'. The `MYSQL' user
     profile that was created earlier in this sequence should be used
     for the profile:

          MYSQLINST/INSMYSQL DIR('/opt/mysql') DATADIR('/opt/mysqldata') USRPRF(MYSQL)

     If you are updating an installation over an existing MySQL
     installation, you should use the same parameter values that were
     used when MySQL was originally installed.

     The installation copies all the necessary files into a directory
     matching the package version (for example
     `mysql-5.0.42-i5os-power-32bit'), sets the ownership on those
     files, sets up the MySQL environment and creates the MySQL
     configuration file (in `/etc/my.cnf') completing all the steps in
     a typical binary installation process automatically. If this is a
     new installation of MySQL, or if the installer detects that this
     is a new version (because the `/etc/my.cnf' file does not exist),
     then the initial core MySQL databases will also be created during
     installation.

  8. Once the installation has completed, you can delete the
     installation file:

          DLTLIB LIB(MYSQLINST)

To start MySQL:

  1. Log into the System i server using a user within the `*SECOFR'
     class, such as the `QSECOFR' user ID.

     *Note*:

     You should start `mysqld_safe' using a user that in the PASE
     environment has the id=0 (the equivalent of the standard Unix
     `root' user). If you do not use a user with this ID then the
     system will be unable to change the user when executing `mysqld'
     as set using `--user' option. If this happens, `mysqld' may be
     unable to read the files located within the MySQL data directory
     and the execution will fail.

  2. Enter the PASE environment using `call qp2term'.

  3. Start the MySQL server by changing to the installation directory
     and running `mysqld_safe', specifying the user name used to
     install the server:

          > cd
          /opt/mysql/MYSQL-5.0.42-I5OS-POWER-32BIT
          > bin/mysqld_safe --user=mysql &

     You should see a message similar to the following:

          Starting mysqld daemon with databases ¬ª
               from /opt/mysql/mysql-enterprise-5.0.42-i5os-power-32bit/data

If you are having problems starting MySQL server, see *Note
starting-server::.

To stop MySQL:

  1. Log into the System i server using the `*SECOFR' class, such as the
     `QSECOFR' user ID.

  2. Enter the PASE environment using `call qp2term'.

  3. Stop the MySQL server by changing into the installation directory
     and running `mysqladmin', specifying the user name used to install
     the server:

          > cd /opt/mysql/MYSQL-5.0.42-I5OS-POWER-32BIT
          > bin/mysqladmin -u root shutdown

     If the session that you started and stopped MySQL are the same,
     you may get the log output from `mysqld':

             STOPPING server from pid file ¬ª
               /opt/mysql/mysql-enterprise-5.0.42-i5os-power-32bit/data/I5DBX.RCHLAND.IBM.COM.pid
             070718 10:34:20  mysqld ended

     If the sessions used to start and stop MySQL are different, you
     will not receive any confirmation of the shutdown.

_Note and tips_

   * A problem has been identified with the installation process on
     DBCS systems. If you are having problems install MySQL on a DBCS
     system, you need to change your job's coded character set
     identifier (`CSSID') to 37 (`EBCDIC') before executing the install
     command, `INSMYSQL'. To do this, determine your existing `CSSID'
     (using `DSPJOB' and selecting option 2), execute `CHGJOB
     CSSID(37)', run `INSMYSQL' to install MySQL and then execute
     `CHGJOB' again with your original `CSSID.'

   * If you want to use the Perl scripts that are included with MySQL,
     you need to download the iSeries Tools for Developers (5799-PTL).
     See `[url]http://www-03.ibm.com/servers/enable/site/porting/tools/[/url]'.




本文转自 fsjoy1983 51CTO博客,原文链接:http://blog.51cto.com/fsjoy/73146,如需转载请自行联系原作者
相关实践学习
每个IT人都想学的“Web应用上云经典架构”实战
本实验从Web应用上云这个最基本的、最普遍的需求出发,帮助IT从业者们通过“阿里云Web应用上云解决方案”,了解一个企业级Web应用上云的常见架构,了解如何构建一个高可用、可扩展的企业级应用架构。
MySQL数据库入门学习
本课程通过最流行的开源数据库MySQL带你了解数据库的世界。   相关的阿里云产品:云数据库RDS MySQL 版 阿里云关系型数据库RDS(Relational Database Service)是一种稳定可靠、可弹性伸缩的在线数据库服务,提供容灾、备份、恢复、迁移等方面的全套解决方案,彻底解决数据库运维的烦恼。 了解产品详情: https://www.aliyun.com/product/rds/mysql 
目录
相关文章
|
9月前
|
前端开发 安全 测试技术
Postman Mac 版安装终极指南:从下载到流畅运行,一步到位
Postman 是 API 开发与测试的高效工具,支持各类 HTTP 请求调试与团队协作。本文详解 Mac 版下载、安装步骤,助你快速上手。同时推荐一体化 API 协作平台 Apifox,集文档、调试、测试于一体,提升开发效率与团队协同能力。
|
11月前
|
关系型数据库 应用服务中间件 nginx
Docker一键安装中间件(RocketMq、Nginx、MySql、Minio、Jenkins、Redis)
本系列脚本提供RocketMQ、Nginx、MySQL、MinIO、Jenkins和Redis的Docker一键安装与配置方案,适用于快速部署微服务基础环境。
|
8月前
|
Ubuntu 关系型数据库 MySQL
MySQL源码编译安装
本文详细介绍了MySQL 8.0及8.4版本的源码编译安装全过程,涵盖用户创建、依赖安装、cmake配置、编译优化等步骤,并提供支持多Linux发行版的一键安装脚本,适用于定制化数据库部署需求。
2090 4
MySQL源码编译安装
|
8月前
|
Ubuntu 关系型数据库 MySQL
MySQL二进制包安装
本文详细介绍了在多种Linux系统上通过二进制包安装MySQL 8.0和8.4版本的完整过程,涵盖用户创建、glibc版本匹配、程序解压、环境变量配置、初始化数据库及服务启动等步骤,并提供支持多发行版的一键安装脚本,助力高效部署MySQL环境。
1327 4
MySQL二进制包安装
|
8月前
|
安全 关系型数据库 MySQL
MySQL包安装 -- SUSE系列(离线RPM包安装MySQL)
本文详细介绍在openSUSE系统上通过离线RPM包安装MySQL 8.0和8.4版本的完整步骤,包括下载地址、RPM包解压、GPG密钥导入、使用rpm或zypper命令安装及服务启动验证,涵盖初始密码获取与安全修改方法,适用于无网络环境下的MySQL部署。
860 3
MySQL包安装 -- SUSE系列(离线RPM包安装MySQL)
|
8月前
|
关系型数据库 MySQL Linux
MySQL包安装 -- SUSE系列(SUSE资源库安装MySQL)
本文介绍了在openSUSE系统上通过SUSE资源库安装MySQL 8.0和8.4版本的完整步骤,包括配置国内镜像源、安装MySQL服务、启动并验证运行状态,以及修改初始密码等操作,适用于希望在SUSE系列系统中快速部署MySQL的用户。
823 3
MySQL包安装 -- SUSE系列(SUSE资源库安装MySQL)
|
8月前
|
NoSQL 算法 Redis
【Docker】(3)学习Docker中 镜像与容器数据卷、映射关系!手把手带你安装 MySql主从同步 和 Redis三主三从集群!并且进行主从切换与扩容操作,还有分析 哈希分区 等知识点!
Union文件系统(UnionFS)是一种**分层、轻量级并且高性能的文件系统**,它支持对文件系统的修改作为一次提交来一层层的叠加,同时可以将不同目录挂载到同一个虚拟文件系统下(unite several directories into a single virtual filesystem) Union 文件系统是 Docker 镜像的基础。 镜像可以通过分层来进行继承,基于基础镜像(没有父镜像),可以制作各种具体的应用镜像。
889 6
|
9月前
|
安全 关系型数据库 MySQL
CentOS 7 yum 安装 MySQL教程
在CentOS 7上安装MySQL 8,其实流程很清晰。首先通过官方Yum仓库来安装服务,然后启动并设为开机自启。最重要的环节是首次安全设置:需要先从日志里找到临时密码来登录,再修改成你自己的密码,并为远程连接创建用户和授权。最后,也别忘了在服务器防火墙上放行3306端口,这样远程才能连上。
2282 16
|
11月前
|
关系型数据库 MySQL Linux
安装MySQL 5.7到红帽系RHEL8+系列上
本文介绍了在RHEL 8及以上系统中安装MySQL 5.7的两种方法:解压安装与RPM包安装。涵盖环境准备、目录配置、数据盘挂载、初始化及服务启动等关键步骤,适用于红帽系(8+)部署MySQL 5.7。

推荐镜像

更多