Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set MYSQL environment variable in Ubuntu?

Tags:

mysql

lampp

So I installed XAMPP (in Ubuntu), and it was successful,

the location of MYSQL is on, /opt/lampp/bin/mysql, and so I have to include the entire path to access mysql as seen below:

$/opt/lampp/bin/mysql -u root -p

And it can login.

But using just "mysql" isn't working; it says not found.

Can you give me an idea on how to set env't variable for mysql?

New in Ubuntu. help? :(

like image 928
Sushi Avatar asked Oct 07 '22 08:10

Sushi


1 Answers

in your home directory there's a file called .bash_profile (use ls -la to see it because files starting with . are by default hidden

There will probably already be a line similar to this one:

PATH=$PATH:$HOME/bin

Change it to

PATH=$PATH:$HOME/bin:/opt/lampp/bin/

This is the easiest way, there are other ways to eg do this so that all users on the system will automatically get this directory in their path, for more detailed answers go to our sister site askubuntu.com

like image 183
fvu Avatar answered Oct 13 '22 12:10

fvu