Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$PATH not being saved after I leave terminal

I just installed mysql server 5.5.20 on my OS X Lion and everything works fine.Now,every time I go into terminal I have to explicitly write:

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

because is not being saved after I leave the command line.I have no idea why such could be.

Ideas?

like image 604
Daniel Avatar asked Feb 03 '12 10:02

Daniel


People also ask

How do I permanently set PATH variable in Linux?

To make the change permanent, enter the command PATH=$PATH:/opt/bin into your home directory's . bashrc file. When you do this, you're creating a new PATH variable by appending a directory to the current PATH variable, $PATH .

How do I permanently export PATH?

Permanently add a directory to $PATHbashrc file of the user you want to change. Use nano or your favorite text editor to open the file, stored in the home directory. At the end of this file, put your new directory that you wish to permanently add to $PATH. Save your changes and exit the file.


2 Answers

You have to add

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

to your ~/.bash_profile or .bashrc (or use similar option when using different shell).

If you want it to be system wide, you should upgrade: /etc/bash.bashrc (on archilnux, can wary on your distribution)

like image 172
Vyktor Avatar answered Oct 17 '22 04:10

Vyktor


If anyone is using MacOs BigSur you should run open ~/.zshrc ` and type the

export PATH=

In my case this was

export PATH=/Applications/MAMP/bin/php/php7.3.24/bin/:$PATH

like image 28
Memli Restelica Avatar answered Oct 17 '22 06:10

Memli Restelica