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


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?

  • So it starts, if so what else is the problem? – George Udosen Nov 24 '17 at 23:03

Xampp uses Mariadb as drop-in replacement for MySQL. You will find Folders and file names with mysql but MariaDB is behind it. Please read mariadb-vs-mysql-compatibility.


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.


First, make sure you start xampp by doing the following

   cd /opt/lampp
   sudo lampp start

Change to bin directory i.e

cd bin (if you are already in /opt/lampp) or cd /opt/lampp/bin

Start mariadb by typing ./mysql -u root -p

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.