(2023) mac install mysql

1. Download

Official website download https://downloads.mysql.com/archives/community/

Select version and system;

 Here you can choose according to whether the computer is arm or x86; if you don’t know, you can enter uname -a in the terminal to view:

2. Installation

Double-click the dmg file to open it;

Problem encountered: ' mysql-8.0.31-macos12-arm64.pkg' cannot be opened because it is from an unidentified developer.

 Open the system settings, open " Privacy and Security ", find the secondary menu of " Security ", and there should be "The use of 'mysql-8.0.31-macos12-arm64.pkg' has been blocked because it is from an unidentified developer." Click " Open anyway ", then reopen the .pkg file and unlock the installation.

 Click to continue until the configuration, Configuration select "Use Legacy Password Encryption", enter the password

 

Successful installation.

Open System Preferences, you can see mysql at the bottom, double-click to display two green dots, which means the installation is successful.

Three, configure mysql

Open the terminal and modify the environment variable

vim .bash_profile

join in

export PATH=${PATH}:/usr/local/mysql/bin

Then source .bash_profile to make the configuration take effect.

In addition, I saw that there is a saying that environment variables need to be configured in the .zshrc file. I am not sure what the difference is, so I will match them.

vim ~/.zshrc

also joined

export PATH=${PATH}:/usr/local/mysql/bin

Then source ~/.zshrc to make the configuration take effect;

After the execution is complete, enter mysql --version, and the version information appears, and the configuration is complete.

 

Fourth, enter mysql

mysql -u root -p

Then enter the previously set password and press Enter to enter the mysql command line interface.

 

Guess you like

Origin blog.csdn.net/Vermouth_00/article/details/130950115