Access MySQL Command Line in XAMPP

Or XLMPP for that matter 😉

There are two ways to do it. Both are basically the same, but one just makes it a lot easier. We’ll go over the harder one first.

First Method:

Start the command prompt, and cd to the xampp directory. It’ll usually be something like:
cd ../../Program Files/xampp
if you used the installer and default install location.

Once in there, cd to the mysql bin directory.
cd mysql/bin

Now, run the command:
mysql.exe --user=root --password=
And the MySQL command line will start. If you’ve changed the username or password of the MySQL user, you need to change the –user= and –password= accordingly.

Second method:

Basically the same way as before, but we’ll create a batch file to make it easier.

First, create a file called mysql_command.bat in the XAMPP directory.

Edit this file with Notepad or any text editor, and paste in this:

@echo off

echo Starting MySQL command line...

mysql\bin\mysql.exe --user=root --password= 

pause

Save it, and change the –user= and –password= if you’ve changed the user or password.

Now, run mysql_command.bat and a command prompt will show up with the MySQL command line running.

It’s as easy as that.