mysql在mac下安装与配置

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:
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,如需转载请自行联系原作者
相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
15天前
|
关系型数据库 MySQL 数据库
mysql卸载、下载、安装(window版本)
mysql卸载、下载、安装(window版本)
|
1月前
|
存储 SQL 关系型数据库
创建并配置RDS实例
在阿里云上创建RDS实例涉及登录控制台、进入RDS管理页面、创建实例、选择数据库引擎和版本、配置实例规格与存储、设定网络与安全组、设置实例信息、确认订单并支付,最后初始化数据库。操作步骤可能因界面更新或数据库引擎不同略有差异。
19 1
|
1月前
|
关系型数据库 MySQL 数据库
rds安装数据库客户端工具
安装阿里云RDS的数据库客户端涉及在本地安装对应类型(如MySQL、PostgreSQL)的客户端工具。对于MySQL,可选择MySQL Command-Line Client或图形化工具如Navicat,安装后输入RDS实例的连接参数进行连接。对于PostgreSQL,可以使用`psql`命令行工具或图形化客户端如PgAdmin。首先从阿里云控制台获取连接信息,然后按照官方文档安装客户端,最后配置客户端连接以确保遵循安全指引。
84 1
|
4天前
|
关系型数据库 MySQL 数据库
《MySQL 简易速速上手小册》第1章:MySQL 基础和安装(2024 最新版)
《MySQL 简易速速上手小册》第1章:MySQL 基础和安装(2024 最新版)
25 4
|
14天前
|
SQL 缓存 关系型数据库
mysql性能优化-慢查询分析、优化索引和配置
mysql性能优化-慢查询分析、优化索引和配置
79 1
|
19天前
|
缓存 关系型数据库 MySQL
MySQL查询优化:提速查询效率的13大秘籍(合理使用索引合并、优化配置参数、使用分区优化性能、避免不必要的排序和group by操作)(下)
MySQL查询优化:提速查询效率的13大秘籍(合理使用索引合并、优化配置参数、使用分区优化性能、避免不必要的排序和group by操作)(下)
|
27天前
|
Ubuntu 关系型数据库 MySQL
Ubuntu 中apt 安装MySQL数据库
Ubuntu 中apt 安装MySQL数据库
68 0
|
1天前
|
监控 网络虚拟化
配置本地MAC镜像示例
1. 创建VLAN10,将Switch与主机相连的接口加入VLAN10,实现主机与Switch间的二层互通。 2. 配置接口GE0/0/4为本地观察端口,负责向Server转发镜像报文。 3. 在VLAN10内配置MAC镜像,将VLAN10内指定MAC地址的主机访问Internet的流量复制一份到本地观察端口。
|
6天前
|
关系型数据库 MySQL Linux
Linux联网安装MySQL Server
Linux联网安装MySQL Server
20 0
|
7天前
|
关系型数据库 MySQL Linux
centos7安装mysql-带网盘安装包
centos7安装mysql-带网盘安装包
40 2