1. How do I install it

Dev.mysql.com/downloads/m…

After downloading, double-click the DMG file and follow the instructions. Then click “Next” or “Confirm” to wait for the installation to be successful.

  • Start the mysql

Go to system preferences, bottom line, find mysql open, click “Start mysql Server”, Start mysql

  • Command line operation

To open iTerm in your application, run the following two commands:

alias mysql=/usr/local/mysql/bin/mysql
alias mysqladmin=/usr/local/mysql/bin/mysqladmin
Copy the code

The purpose of these two commands is to run the mysql command directly by opening iTerm, rather than having to go to the mysql installation directory. Next, you need to reset your password.

  • Reset password command
mysqladmin -u root -p password newpass
Copy the code

Newpass is your new password

After you run the password reset command, the system prompts you to enter the old password. For those of you who have installed mysql5.6 or earlier, the default password assigned to user root is root. But now if you type root, the system prompts you with a password error.

The previous version 5.7 does not assign a default password to the root user, but a temporary password. If you are careful, a temporary password will pop up for you to save after installing mysql. If you don’t save it, it doesn’t matter, it will be in the notification bar on the right, as shown below:

My temporary password is _; Kb8t7 = -zou Enters temporary password, password changed successfully, then log in with new password:

mysql -u root -p
Copy the code

Press Enter, new password, press enter, login successful! Now you can write your SQL commands!

2, how to uninstall

  sudo rm /usr/local/mysql  
  sudo rm -rf /usr/local/mysql*  
  sudo rm -rf /Library/StartupItems/MySQLCOM  
  sudo rm -rf /Library/PreferencePanes/My*  
  vim /etc/hostconfig  (and removed the line MYSQLCOM=-YES-)  
  rm -rf ~/Library/PreferencePanes/My*  
  sudo rm -rf /Library/Receipts/mysql*  
  sudo rm -rf /Library/Receipts/MySQL*  
  sudo rm -rf /var/db/receipts/com.mysql.* 
Copy the code