Installing MySQL 5.7 in homebrew

Time:2021-12-29

Installing homebrew

https://brew.sh/
Installing MySQL 5.7 in homebrew

brew -v

#See if homebrew is available
brew doctor

Install MySQL 5.7

#Search MySQL version
brew search mysql

#Installation 5.7
brew install [email protected]

#Configure environment variables, as shown in red box 1 below
echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >> ~/.zshrc

#Make configuration effective
source ~/.zshrc

#Start MySQL service
mysql.server start

Installing MySQL 5.7 in homebrew

MySQL set password

After MySQL is installed, there is no password configured. MySQL is configured to allow only connections from localhost by default

#Enter the password modification command prompted after installation
mysql_secure_installation


#The simple password cannot be set. The password strength verification plug-in validate is added_ password
 ... Failed! Error: Your password does not satisfy the current policy requirements


#View authentication password policy
mysql> select @@validate_password_policy;
+----------------------------+
| @@validate_password_policy |
+----------------------------+
| LOW                        |
+----------------------------+


#View several global parameters related to MSYQL password
mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+-------+
| Variable_name                        | Value |
+--------------------------------------+-------+
| validate_password_check_user_name    | OFF   |
| validate_password_dictionary_file    |       |
| validate_password_length             | 8     |
| validate_password_mixed_case_count   | 1     |
| validate_password_number_count       | 1     |
| validate_password_policy             | LOW   |
| validate_password_special_char_count | 1     |
+--------------------------------------+-------+


#Modify MySQL parameter configuration

mysql> set global validate_password_mixed_case_count=0;

mysql> set global validate_password_number_count=0;

mysql> set global validate_password_special_char_count=0;

mysql> set global validate_password_length=3;


#Check whether the modification is successful
mysql> SHOW VARIABLES LIKE 'validate_password%';


#Change password
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('root');

Recommended Today

Huawei account “No. 1 play” experience helps the growth of game users

On August 1, Huawei HMS core Sparkle game application innovation salon was successfully held in Shanghai. At the scene, the guests introduced the functions and integration value of Huawei account kit, which attracted the interest of many developers. As one of the basic development service capabilities of HMS core, Huawei account service supports users to […]