On mac, how can I use a terminal to open MySQL and xamppmysql that comes with XAMPP?
Start directly and describe the possible errors in each step.
1. Install xampp, open the terminal, and enter:
mysql -u root -p
It's a good luck to enter and wipe it. You don't need to read it later.
2. If the prompt "command not found" is displayed, continue the input and execution on the terminal:
ln -s /applications/xampp/bin/mysql /usr/bin
Note: Do not write usr as user!
If the execution is successful, return to step 1!
3. If the operation fails, operation not permitted is returned, indicating that there is no permission. In this case, modify the mysql permission under bin to read and write (how to modify self-search)
4. After the change, execute Step 1 again. If the problem persists, use the root user to perform step 2, that is:
sudo ln -s /applications/xampp/bin/mysql /usr/bin
5. If the problem persists, why? It took a long time to find the cause and finally found out that mac OS uses Rootlees, which can be understood as kernel protection for a higher level system,
The/usr/bin operation is locked and can only be performed with an APPLE certificate.
What should we do?
6. Method: restart the computer and press and hold
command+r
Go to restore partition, and find the terminal to start running in the utility bar.
7. Input
csrutil disable
Disable Protection
Enter
reboot
Restart your computer, or click restart.
8. restart the computer, open the terminal, and execute the Step 4 command to introduce the absolute position of the tool to/usr/bin.
9. At this time, you can open step 1.
10. Finally, for the sake of security, let's start Rootless. The method is the same as step 1 and Step 2. Execute the command.
csrutil enable
Restart the computer and then OK.
11. Restart your computer. Remember to start the mysql service of xampp first. Otherwise, an error will be reported.
can't connect to local MySQL server...
12. The end!
The above section describes how to use any terminal on mac to open MySQL that comes with XAMPP. I hope it will help you.