It’s finally solved after many hardships. Please refer to the notes of Niu Ren and record it
First, install brew and Baidu. There are many tutorials
#Install brew install mysql #Configure environment variables echo'export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile #Make environment variables take effect source ~/.bash_profile #Start mysql service through script mysql.server start #Start mysql and set to boot brew services start mysql #Initialization, set password mysql_secure_installation ya..... bin% mysql_secure_installation Enter password: Securing the MySQL server deployment. VALIDATE PASSWORD PLUGIN can be used to test passwords //Password verification plug-in, in order to improve security, you need to verify the password and improve security. It checks the strength of password // It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD plugin? //Prompt to install the password verification plugin Press y|Y for Yes, any other key for No: y There are three levels of password validation policy: //Three levels of password validation policy LOW Length >= 8 //The minimum length is greater than or equal to 8 characters MEDIUM Length >= 8, numeric, mixed case, and special characters //Numbers, letters, and special characters are mixed, the specific ones should be at least 1 number, 1 letter, 1 special character, and the length should not exceed 32 characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file // The most stringent, plus, the dictionary file Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2 //Here I choose 2 MEDIUM Using existing password for root. Estimated strength of the password: 50 //Here is also the rating of password strength Change the password for root ?((Press y|Y for Yes, any other key for No): y New password: //Password Re-enter new password: Estimated strength of the password: 50 Do you wish to continue with the password provided? (Press y|Y for Yes, any other key for No): y //Prompt to use the password you just entered? ... Failed! Error: Your password does not satisfy the current policy requirements New password: //Password Re-enter new password: Estimated strength of the password: 100 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No): y By default, a MySQL installation has an anonymous user, //By default, MySQL has an anonymous user, allowing anyone to log into MySQL without having to have //This anonymous user does not have to be created for them by a user. An anonymous user allows anyone to log into MySQL, a user account created for them. This is intended only for //This is just to facilitate test use testing, and to make the installation go a bit smoother. You should remove them before moving into a production //When using in a formal environment, it is recommended that you remove them environment. Remove anonymous users? (Press y|Y for Yes, any other key for No): y //Prompt to remove anonymous users Success. Normally, root should only be allowed to connect from //Under normal circumstances, root users are only allowed to log in using "localhost", 'localhost'. This ensures that someone cannot guess at // to ensure that someone cannot guess at the root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No): n // ... skipping. By default, MySQL comes with a database named'test' that //By default, there is a test library in the MySQL database that can be accessed by any user. anyone can access. This is also intended only for testing, //This is also intended only for testing and should be removed before moving into a production // in a formal environment, should be removed environment. Remove test database and access to it?(Press y|Y for Yes, any other key for No) : y - Dropping test database... Success. - Removing privileges on test database... Success. Reloading the privilege tables will ensure that all changes //Refresh the permission table to ensure that all modifications can take effect immediately made so far will take effect immediately. Reload privilege tables now?(Press y|Y for Yes, any other key for No) : y Success. All done!
brew install mysql-connector-c
brew install openssl
After installation, the terminal will display the method of configuring environment variables
If you need to have [email protected] first in your PATH, run: echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >> ~/.zshrc For compilers to find [email protected] you may need to set: export LDFLAGS="-L/opt/homebrew/opt/[email protected]/lib" export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include"
Unlink MySQL and the linked MySQL connector mysql-connector-c
brew unlink mysql brew link --overwrite mysql-connector-c
As shown in the figure, mysql-connector-c has a warning
warning: MySQL client is keg only and must be linked with -- force.
brew link -- overwrite mysql-connector-c -- force
PIP install mysqlclient will not cause any errors
Connect MySQL again
Do the opposite of unlinking MySQL and the linked MySQL connector mysql-connector-c:
brew unlink mysql-connector-c brew link --overwrite mysql --force
- Python Error: pip install mysql-connector-python failed
- Pip3 install Mysqlclient Error: Command “python setup.py egg_info“ failed with error
- [Solved] Error: [email protected]: wrong number of arguments (given 1, expected 0)
- MYSQL-python Install EnvironmentError: mysql_config not found
- Error in installing Python 3.6.8 for MacBook pyenv [Solved]
- Python environment error, bad interpreter: there is no file or directory
- MAC OS install python3 Error: Permission denied @ dir_s_mkdir-/usr/local/Frameworks
- Linux Fatal Python error: Py_Initialize Unable to get the locale encoding
- [Solved] ModuleNotFoundError: No module named ‘requests‘
- Python classes that connect to the database
- Brew Install python Error: tar: Error opening archive: Failed to open’***‘
- [Solved] Mac ffmpeg Install Error: filenotfounderror: [errno 2] no such file or directory: ‘ffmpeg’: ‘ffmpeg’
- PIP Install Mysqlclient error C1083: Cannot open include file: ‘mysql.h‘: No such file or directory
- Python3 Error: Cannot uninstall ‘numpy’. It is a distutils installed project and thus we cannot accurate
- [zipfile] Python packages files as zip packages & decompresses them
- Python 3 uses the relative path import module
- Brew install XXX and display error: [email protected] [How to Solve]
- [Solved] Mujoco Error: Missing path to your environment variable.
- [Solved] Django Error: django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
- Python RarFile unpack RAR package Error Rarfile.RarCannotExec: Cannot find Working Tool