mysql在mac下安装与配置

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,如需转载请自行联系原作者

你可能感兴趣的:(mysql在mac下安装与配置)