Ubuntu – Xampp: Access MySQL from terminal

command lineMySQLxampp

I found an answer here: How do I start the MySQL console in XAMPP? but it is not working for me.

First if I go to the folder

/opt/lampp/bin/

if I then call

mysql -u root

Then I get notified that this command is unknown. I don't understand why.
However, I can do

./mysql -u root

but then for some reason MariaDB gets started:
enter image description here

So whats the correct way to access MySQL from terminal?

Best Answer

The reason your not able to start it mysql -u root -p is because the folder location /opt/lampp/ isn't in included in your path. Add this line to your .bashrc file:

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

Then close it and source it with:

source ~/.bashrc

If no errors comes from the above source command then you can now do mysql -u root -p from your terminal.