How to Install MySQL on MacOSIntroductionMySQL is an opensource, relational database management system. Its name is the combination of two words that are My + SQL where my is the name of co-founder Michael Widenius's daughter and SQL is the abbreviation of Structured Query Language. MySQL is widely used as a database system in various well-known companies like Google and Facebook. In this tutorial, we will learn the installation process of MySQL server on MacOS. Prerequisites
InstallationFollowing steps are used to install MySQL on MacOS. 1) Download the latest version Download the latest version of MySQL community server that is 5.7.20 from its official website or simply copy and paste https://dev.mysql.com/downloads/file/?id=473576 into our browser search bar. The file will be downloaded in disk image format which is to be mounted first on our volumes directory. 2) Mount the disk image file Hdiutil is used with the mount option to mount the disk image file on volumes directory of root. 3) Using Installer to Install MySQL package The command installs MySQL community server to the root directory. During the installation process, it also sets the default password for root to access MySQL. When we install MySQL on MacOS, a default username and password is created which is shown to the user at the time of installation. 4) Unmount the Disk Image File The MySQL package mounted on volumes directory needs to be unmounted. Hdiutil is used with the unmount option to do so. 5) Starting MySQL On MacOS, all the support files are located at /usr/local/MySQL. Support-Files contains MySQL.server which is actually started when we need to access our database. We must have the path information of MySQL server in order to start MySQL. We must have super user permissions to start and stop MySQL database. 6) Working on MySQL Command Line 1. Accessing from command line To run MySQL from command line, we need to start MySQL server first. Then, following command will be executed. Where root is the username and password is r>mpyW,-J4xS . 2. Create database To create database, we need to execute a SQL query which is as follows. 7) Stopping MySQL To stop database, use the following command. Next TopicHow to Install MongoDB on Mac |