On Mac systems, MySQL is usually installed with a DMG package on the graphical interface as prompted. MySQL also provides the CompressedTARArchive binary package installation method, that is, install-free and decompress the running version on the Mac system. to install MySQL Server, the DMG package is usually installed on the graphical interface as prompted. In addition, MySQL also provides the Compressed TAR Archive binary package installation method, that is, the installation-free and decompressed running version is simpler than the DMG package, and the command line-only operation is more in line with the SPOF of the coders.
System environment: OS X Yosemite 10.10.3 login user: wid (sudo permission) MySQL version: 5.6.24 (mysql-5.6.24-osx10.9-x86_64.tar.gz) MySQL Download: http://dev.mysql.com/downloads/mysql/
Find the location of the downloaded MySQL tar.gz file, which is usually in the Downloads Directory of the current user, that is,/Users/ /Downloads, enter the terminal, and decompress the tar.gz file:
cd /Users/
/Downloadstar zxvf mysql-5.6.24-osx10.9-x86_64.tar.gz
Decompress the package to obtain the mysql-5.6.24-osx10.9-x86_64 Directory, move the unzipping directory to the default installation path of MySQL/usr/local/mysql,/usr/local path does not exist, first create sudo mkdir/usr/local.
# Move the unzipped binary package to the installation directory sudo mv mysql-5.6.24-osx10.9-x86_64/usr/local/mysql # Change the mysql installation directory to the user and user group cd/usr/localsudo chown-R root: wheel mysql # execute the mysql_install_db script in the scripts directory to complete some Default initialization (create a default configuration file, authorization table, etc.) cd/usr/local/mysqlsudo scripts/mysql_install_db -- user = mysql
Installation is complete. Test start, restart, and stop:
Cd/usr/local/mysql # start sudo support-files/mysql. server start # restart sudo support-files/mysql. server restart # stop sudo support-files/mysql. server stop
Initialize the MySQL root password
cd /usr/local/mysql/bin./mysqladmin -u root password
Connect to the database through the built-in MySQL Client
cd /usr/local/mysql/bin./mysql -u root -p