Installing MySQL on Mac _ MySQL

Source: Internet
Author: User
This article mainly introduces how to install MySQL on Mac. This article is completed in four steps, which is easy to understand and can be referenced by anyone who needs it. 1. download MySQL and select the version to be downloaded. we recommend that you select the DMG installation package for ease of use.

2. unzip and install the mysql-5.6.12-osx10.7-x86_64.pkg in the DMG package, and then install MySQLStartupItem. pkg.

# Note that MySQL Mac OS X PKG is installed in/usr/local/mysql-VERSION, and a symbolic connection is installed./usr/local/mysql points to a new location. If the/usr/local/mysql directory exists, first change it to/usr/local/mysql. bak. After installation, the installer runs mysql_install_db to create an authorization table in the MySQL database.

The installation layout is similar to that of the tar binary distribution. all MySQL binary codes are in the/usr/local/mysql/bin directory. By default, the MySQL socket file is created as/tmp/mysql. sock. If you want to automatically start MySQL during system Startup, you also need to install MySQL Startup Item. In MySQL 5.1, it is part of the Mac OS X installation disk image and is an independent installation package. Double-click the MySQLStartupItem. icon and follow the instructions to install it.

The Startup Item of MySQL 5.1 is installed in/Library/StartupItems/MySQLCOM. When Startup Item is installed, add the variable MySQLCOM =-YES-to the system configuration file/etc/hostconfig -. If you want disable to automatically start MySQL, you only need to change this variable to MySQLCOM =-NO -. After installation, you can run the following command in the terminal window to start MySQL. You must have the administrator privilege to perform this task.

3. if you have installed Startup Item:

The code is as follows:


Shell> sudo/Library/StartupItems/MySQLCOM start
(Enter your password, if necessary)
(Press Control-D or enter "exit" to exit the shell)

If you do not use Startup Item, enter the following command sequence:

The code is as follows:


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)

4. run/usr/local/mysql/bin/mysql.

The code is as follows:


# Note if the error "Can't connect to local MySQL server through socket"/tmp/mysql. sock "(2) occurs:
Cd/usr/local/mysql/bin/mysql

Modify the my. cnf file in this folder to add socket =/tmp/mysql. sock

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.