Note: 1, this article without Bo Master consent, not reproduced!
2, all the terminal statements are displayed on the branch, so as not to see the wrong;
Start directly, the process of each step may appear errors are described.
1. Install the XAMPP, then open the terminal, enter:
Mysql-u root-p
Successfully entered, wipe, you have good luck, you do not have to look at the back.
2. If command not found is prompted, continue entering execution at the terminal:
Ln-s/applications/xampp/bin/mysql/usr/bin
Note: usr don't write to user!
If executed successfully, go back to the 1th step and you are ready to go!
3, if not successful, return operation not permitted, stating that there is no permission, this time to the bin under the MySQL permissions modified to read and write (self-search how to modify)
4, after the change, the implementation of the 2nd step again, found or not, with the root user to perform the 2nd step, namely:
sudo ln-s/applications/xampp/bin/mysql/usr/bin
5, if still not, why? It took a long time to find the reason, and finally found it, because Mac OS uses rootlees, which can be understood as the kernel protection of a higher level system,
The operation of the/usr/bin is locked and can only be operated with an Apple certificate.
So what do we do?
6, Method: Restart the computer, press and hold
Command+r
Go to the recovery partition, and then locate the terminal in the utility bar to start running.
7. Input
Csrutil Disable
Turn off protection
Re-enter
Reboot
Restart your computer, or manually click Restart.
8, restart the computer, open the terminal, perform the 4th step command, you can put the absolute position of the tool into the/usr/bin
9, this time in the implementation of the 1th step can be opened normally.
10, finally, for security reasons, we still have to start the rootless, the method with the 6th step, 7th step, the execution of orders
Csrutil Enable
Restarting the computer will be OK.
11, every time restart the computer, remember to start the XAMPP MySQL service, otherwise it will error
Can ' t connect to local MySQL server ...
12. The end!
How to open xampp MySQL with a terminal on Mac