How to play MySQL Server under Mac

Source: Internet
Author: User

Recently engaged in transaction-related statements, started the Select for update, to do experiments on ECS, I found that the version I installed only support MyISAM, do not support InnoDB, the transaction can not play. A copy of MySQL Server was installed on the Mac.

How to install, how to play turn, see the instructions are the best ~

On my machine, the Startupitems installation failed, and I don't know why. However, the MySQL server installation is successful, so it is OK to start with manual mode.


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 is able to connect to the MySQL server, for example, by
Running '/usr/local/mysql/bin/mysql '.



Mysql> show engines;
+------------+---------+----------------------------------------------------------------+--------------+------+ ------------+
| Engine | Support | Comment | Transactions | XA | savepoints |
+------------+---------+----------------------------------------------------------------+--------------+------+ ------------+
| InnoDB | YES | Supports transactions, Row-level locking, and foreign keys | YES | YES | YES |
| Mrg_myisam | YES | Collection of identical MyISAM tables | NO | NO | NO |
| Blackhole | YES | /dev/null Storage Engine (anything you write to it disappears) | NO | NO | NO |
| CSV | YES | CSV Storage Engine | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| Federated | NO | Federated MySQL Storage Engine | NULL | NULL | NULL |
| ARCHIVE | YES | Archive Storage Engine | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
+------------+---------+----------------------------------------------------------------+--------------+------+ ------------+

8 rows in Set (0.00 sec)


can see support InnoDB


And then you can start playing.


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 this older versions of Mac OS X (for example,
10.1.x or 10.2.x) is *not* supported by the This package.


The package is located inside a disk image ('. DMG ') file
Need to mount by double-clicking it 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, being sure to shut
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 the
Icon. This launches-Mac OS X package Installer, which guides
Through the installation of MySQL.


Due to a bug on the MAC OS X Package Installer.
Message in the destination Disk selection dialog:


You cannot install the This software on the this disk. (NULL)


If This error occurs, simply click the "Go back" button once to return
To the previous screens. Then click on ' Continue ' to advance to the
Destination disk selection again, and you should is 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's points to the new location. If a Directory
Named '/usr/local/mysql ' exists, it's 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 is 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 the 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
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, does a search for ' MySQL, ' and read the item entitled
' Installing MySQL. '


For preinstalled versions of MySQL on Mac OS X Server, note especially
That's 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
' http://www.entropy.ch ', you can simply follow the update instructions
For packages using the binary installation layout as given on his pages.


If you is 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 has 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's 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 is installed only
Once. There is no need-install it each time upgrade the MySQL
Package later.


The Startup Item for MySQL was installed into
'/library/startupitems/mysqlcom '. (Before MySQL 4.1.2, the location was
'/library/startupitems/mysql ', but this 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 variable to ' mysqlcom=-no-'.


On Mac OS X Server, the default MySQL installation bundled with the
Operating system uses the variable ' MYSQL ' in the '/etc/hostconfig '
File. The Sun Microsystems, Inc. "Startup Item" installer disables
This variable by setting it to ' mysql=-no-'. This avoids boot time
Conflicts with the ' mysqlcom ' variable used by the Sun Microsystems,
Inc. "Startup Item". However, it does not shut down a running MySQL
Server. You should does that yourself.


After the installation, you can start with MySQL by running the following
Commands in a terminal window. You must has administrator privileges
To perform the 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 is able to connect to the MySQL server, for example, by
Running '/usr/local/mysql/bin/mysql '.


*note*: The accounts that is listed in the MySQL grant tables
Initially has no passwords. After starting the server, you should set
Up passwords-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. Modifying the appropriate startup file for
Your shell. For more information, see *note invoking-programs::.


If you is upgrading an existing installation, note that installing a
New MySQL PKG does not remove the directory of a 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 and the new installation, you ll need
To copy the contents of the old data directory to the new data
Directory. Make sure this neither the old server nor the new one is
Running. After you are copied over the MySQL database
Files from the previous installation and has successfully started the
New server, 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 '.

How to play MySQL Server under Mac

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.