I'm trying to add mysql to path so that SQL commands interact with a MySQL database, however, permission denied. How do you solve this problem?
For macOS Catalina 10.15.6
To find MySQL Location
/usr/local/mysql/bin
This returns error
echo 'export PATH="/usr/local/mysql/bin:$PATH"' >> ~/.bash_profile
zsh: permission denied: /Users/bolouie/.bash_profile
Solution to zsh permission denied by specifying ~/.zshrc
To add MySQL to Path (permanently)
echo 'export PATH="/usr/local/mysql/bin:$PATH"' >> ~/.zshrc
This returns
source ~/.zshrc
Set root user password for mysql login
mysql -u root -p
This returns error
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
*Started MySQL Server to connect with "root" user password
sudo /usr/local/mysql/support-files/mysql.server start
Enabled MySQL prompt
Welcome to the MySQL monitor...
mysql>
First stop mysql if it's running by typing in terminal
then start mysql by typing
open a new terminal window
enter the password and then will run