If you want to operate in the mysql terminal (Terminal), the need to add mysql path to zsh in this example:
# Open the settings file
vim ~ / .zshrc
# Add the path
the PATH = "/ usr / local / MySQL / bin: $ the PATH";
Export the PATH
Application #
Source ~ / .zshrc
. 1
2
. 3
. 4
. 5
. 6
. 7
. 8
. 9
terminal (on / off / restart) operation is mysql:
# Start MySQL service
sudo /usr/local/mysql/support-files/mysql.server start
# Close the MySQL service
sudo /usr/local/mysql/support-files/mysql.server stop
# MySQL server restart
the sudo /usr/local/mysql/support-files/mysql.server the restart
. 1
2
. 3
. 4
. 5
. 6
. 7
. 8
enters the command-line operation mysql
Input Terminal:
-u root -p mysql
1
there is no problem, you need to enter the terminal or mysql password (no password, then just knock) directly into the mysql command line.
Possible problems encountered
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket '/tmp/mysql.sock’
Encounter this problem mysql does not start properly, view open service occurred during what is wrong.
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
Encounter this problem mysql password.
ERROR 1045 (28000) Solutions
Skip permission checks, direct access (just learning convenience)
# Set to enter the my.cnf file
sudo vim /etc/my.cnf
# Add [mysqld] in
Skip-Grant-Tables
. 1
2
. 3
. 4
. 5
If the file is not to be provided with reference to the file my.cnf
:! Wq save, restart the mysql service, you can directly use this command to enter the mysql command line:
-u root mysql
1
modify mysql password
mac under the modified mysql password
---------------------