On Mac systems, MySQL is usually installed with a DMG package on the graphical interface as prompted. In addition, MySQL also provides the CompressedTARArchive binary package installation method, that is, no installation or decompression of the running version, compared with the DMG package, the free installation version is installed on the Mac system. MySQL Server is usually installed with the DMG package on the graphical interface as Prompted. 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.4MySQL version: mysql-5.6.26-osx10.9-x86_64.tar.gzMySQL Download: http://dev.mysql.com/downloads/mysql/
Find the location of the downloaded MySQL tar.gz file, usually in the current user's Downloads Directory, enter the terminal ,.
Decompress the tar.gz file:
cd
cd Download
tar zxvf mysql-5.6.26-osx10.9-x86_64.tar.gz
Move folder location and configuration
Decompress the package and move the folder to the/usr/local path. if the folder does not exist, create sudo mkdir/usr/local first.
# Move the unzipped binary package to the sudo mv mysql-5.6.26-osx10.9-x86_64/usr/local/installation directory/
cd /usr/local
Sudo mv mysql-5.6.26-osx10.9-x86_64 mysql # Modify file name
Sudo chown-R root: wheel mysql # Note: change root to your current user name. Otherwise, the service cannot be started # execute the mysql_install_db script in the scripts directory to complete some Default initialization (create default configuration files, authorization tables, 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