#一, enter MySQL from the terminal
is different from MySQL under Windows. The MySQL installation path under Mac is different, so the operation will be slightly different;
The following actions are premised on installing MySQL by default.
# #一 (1): After you open the terminal, set the path, and then do not specify the path after each step (case sensitivity):
Input:
Path= "$PATH":/usr/local/mysql/bin
Enter confirm;
Re-enter: mysql-uroot-p; (starting from the same operation as the Windows edition)
Enter the MySQL password to confirm, if the password is correct, you can go to MySQL, you will see the following information roughly:
Welcome to the MySQL Monitor. Commands End With; or \g.your MySQL connection ID is 4Server version:5.7.11 mysql Community Server (GPL)
# #一 (2): If you omit the first step of the set path operation. So the next step is to take the path. Like what:
Mysql-uroot-p to write
/usr/local/mysql/bin/mysql-uroot-p
#二, modify MySQL port number
The My.ini,mac modified port number differs from windows in:
/library/launchdaemons/com.oracle.oss.mysql.mysqld.plist file,
The file to be opened with terminal, Terminal input command: open/library/launchdaemons/com.oracle.oss.mysql.mysqld.plist
After opening the file, locate the <string>--port=3307</string> under the <array> field, change the following 3307 to your port number, and if you cannot find it, add it yourself and save the exit.
Note: Stop MySQL in System Preferences before modifying and then turn on the MySQL service.
Some MySQL operations under the Mac