0
点赞
收藏
分享

微信扫一扫

关于mysql mac 输入mysql -uroot -p 不能访问的问题

zhoulujun 04-11 08:30 阅读 0

解决办法:

先查看mac本身安装的shell

cat /etc/shells
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/bash
/bin/csh
/bin/dash
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh

查看默认shell

chsh
# Changing user information for iOSTeam.
# Use "passwd" to change the password.
##
# Open Directory: /Local/Default
##
Shell: /bin/zsh
Full Name: iOSTeam
Office Location:
Office Phone:
Home Phone:
~              

默认shell为zsh,说明安装mysql时部署的全局变量bash的效用没生效,需要配置的为

vi ~/.zshrc

进入后输入如下

export PATH=${PATH}:/usr/local/mysql/bin

结果如下:

Last login: Wed Apr 10 01:06:29 on ttys015
(base) jerrychen@JerrydeMacBook-Air ~ % vi ~/.zshrc                            
export PATH="/Users/jerrychen/学习/bin:$PATH"
export PATH=${PATH}:/usr/local/mysql/bin
export PATH="/Users/jerrychen/学习/Anaconda-1.4.0-MacOSX-x86_64/bin:$PATH"
source ~/.bash_profile


# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/jerrychen/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/jerrychen/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/jerrychen/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/Users/jerrychen/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

~                                                                               
"~/.zshrc" 21L, 684B

保存退出后执行

source ~/.zshrc 

退出终端,重新打开后输入mysql -uroot -p,成功进入

举报

相关推荐

0 条评论