Mac installation software is basically an operation:
First download the software, then double-click Install installation software, and finally add the path, the MySQL installation process is the same:
: https://dev.mysql.com/downloads/mysql/
I downloaded the mysql5.6 version, then the installation, the installation path is the/usr/local directory, Linux under the user's own installation of the software is basically in this directory, and then add the path, this is the path to run the MySQL command, to find out.
The executable program is usually located in the bin directory of the installation path of the software, in MySQL, for example, there are many executable programs under/usr/local/mysql/bin/, including Mysql,mysqld,mysqldump.
Using the VI Editor to open ~/.bash_profile
Add the following content:
Path= $PATH:/usr/local/mysql/bin
Then, after saving, execute the following command on the shell command line:
SOURCE ~/.bash_profile
All commands under/usr/local/mysql/bin can then be used directly under any path, such as logging in to MySQL and using the following command directly:
Mysql-uroot
If you do not add a path, you can also execute the MySQL command, this is the basis for the design of Linux, here is no longer a statement, if you are in your home directory, you can start MySQL by command
/usr/local/mysql/bin/mysql-uroot
The default MySQL password is empty, after entering MySQL, it must be after entering MySQL , execute the following command to change the password for the root user of MySQL:
Set password for ' root ' @ ' localhost ' =password (' 123456 ')
The above command is for the root user to set a password of 123456, you can use the following command to log in
mysql-uroot-p123456
Install MySQL under Mac