'Mac terminal bash profile cannot add another path after downloading Anacoda

I started to learn MySQL recently and I have a 2015 MacBook Air. After installing MySQL server, I ran pip install MySQL-connector-python.

Everything worked perfectly fine but my terminal cannot find mysql command line.

I did a lot of reseach on internet and I figured out the reason is my terminal environment hasn't located mysql, so I tried to add the bash_profile but it doesn't work.

I began to think that maybe I got the wrong path of mysql, so I did another batch of searches on how to get the right path of mac folders. And it's still not working.

Finally, I typed export path: path....(regular MySQL path), and then I use the mysql command, and the terminal could find it!

Now, I can use MySQL but each time I have to type export (MySQL path).

I doubt the reason why I cannot add a valid bash_profile path is that I have an anaconda in my computer and there is a long path belonging to anaconda inside my bash_profile.

Here is what my bash_profile looks like and I hope someone who knows Linux can help me out. I just want to know why and if you want to share more, you are so welcome!

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

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

As you can see, I already added the path, but my terminal just cannot find mysql.

Side Note: My computer is really old but in MacOS 11.8 big sur, so that could be a possible reason but I m just not knowing enough to be sure.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source