brew install mysql-client
echo 'export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH"' >> ~/.zshrc
ps -ax | grep mysql | grep -v grep
then connect:
mysql --socket /tmp/mysql_3306.sock -uroot
add this to ~/.bashrc
function mysqls() {
command mysql --socket /tmp/mysql_$1.sock -uroot
}
and then mysqls 3036
connects port 3306 DBngin mysql server.`
mysql-client is keg-only, which means it was not symlinked into /opt/homebrew,
because it conflicts with mysql (which contains client libraries).
If you need to have mysql-client first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH"' >> ~/.zshrc
For compilers to find mysql-client you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/mysql-client/lib"
export CPPFLAGS="-I/opt/homebrew/opt/mysql-client/include"