4

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?

Adam
  • 2,600

3 Answers3

9

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.

George Udosen
  • 37,534
2

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.

KK Patel
  • 19,753
0

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

David
  • 126