简体   繁体   中英

Can't write to .bash_profile file even when I am admin

I am trying to fix the problem with MySQL Server. When I type in terminal MySQL I get command not found.

I know I have to edit .bash_profile file and add to it this line:

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

The problem is I can't write to it. I tried these commands:

brackets ~/.bask_profile
sudo brackets ~/.bash_profile
touch ~/.bash_profile; open ~/.bash_profile
sudo touch ~/.bash_profile; open ~/.bash_profile

All the time I get a message that I am not allowed to write to this file because it is protected.

My question is, how can I write to this file and start MySQL Server?

Thank you for your help.

Cheers


EDIT:

Output in terminal of command:

ls -l ~/.bash_profile

is

-rw-r--r--  1 root  staff  447 13 paź 17:33 /Users/macos/.bash_profile

EDIT2:

  1. Could you write to me about how to find the path to the .bash_profile file? I think changing the privileges of this file will be the solution to the problem.

The solution was using vi/vim editor:

vi ~/.bash_profile

Then in vi/vim I pasted this line:

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

And saved it with this commands:

:wq!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM