Debug School

rakesh kumar
rakesh kumar

Posted on • Updated on

Linux:How do I set MYSQL environment variable in Ubuntu?

how-do-i-set-mysql-environment-variable-in-ubuntu
how-can-i-use-an-environment-variable-in-the-mysql-console
setting-environment-variables

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:

Problem

Image description

$/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? :(
Enter fullscreen mode Exit fullscreen mode

SOlution
4

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/
Enter fullscreen mode Exit fullscreen mode

============OR================
In root vi .bashsrc

Image description

Image description

Image description

Image description

export PATH=$PATH:/opt/lampp/bin
Enter fullscreen mode Exit fullscreen mode

Image description
====================or===================

other than root user

Image description

Set db name,username and pwd

Image description

=================================

Another Method

Image description

Image description

Image description

Top comments (0)