method one:
(1) Use brew install mysql
(2) An error is reported when using mysql -uroot to connect:
Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/usr/local/mysql/lib/plugin/caching_sha2_ password.so, 2): image not found
Solution
In System -> System Preferences, find mysql, then initialize database, and then enter the password
Method Two
Download the .dmg file from the mysql official website and install it