Xampp Mysql Cmd

How can I access the MySQL command line with XAMPP for Windows?

  1. Xampp Mysql Cmd Server
  2. Xampp
  3. Xampp Start Mysql From Cmd
  1. Create MySQL Database Using Command Prompt XAMPP 2020. If playback doesn't begin shortly, try restarting your device.
  2. Your MySQL binaries should be somewhere under your XAMPP folder. Look for a /bin folder, and you'll find the mysql.exe client around. Let's assume it is in c: xampp mysql bin, then you should fireup a command prompt in this folder. That means, fire up 'cmd', and type: cd c: xampp mysql bin mysql.exe -u root -password.

Using the XAMPP shell is generally going to be the simplest and quickest method for changing your MySQL password. It does involve using the command line, which can seem daunting at first. However, it’s actually fairly straightforward. For all this content to make sense,i have put together a very simple video with all the steps on how to connect to mysql database through windows Command Prompt Console. Your MySQL binaries should be somewhere under your XAMPP folder. Look for a /bin folder, and you'll find the mysql.exe client around. Let's assume it is in c:xamppmysqlbin.


Your MySQL binaries should be somewhere under your XAMPP folder. Look for a /bin folder, and you’ll find the mysql.exe client around. Let’s assume it is in c:xamppmysqlbin, then you should fireup a command prompt in this folder.

That means, fire up “cmd”, and type:

If you want to use mysqldump.exe, you should also find it there.

Log into your mysql server, and start typing your commands.

Hope it helps…


On the Mac, or at least on my Mac using a default install, I accessed it at:


To access the mysql command in Windows without manually changing changing directories, do this:

  • Go to Control Panel > System > Advanced system settings.
  • System Properties will appear.
  • Click on the ‘Advanced’ tab.
  • Click ‘Environment Variables’.
  • Under System Variables, locate ‘Path’ and click Edit.
  • Append the path to your MySQL installation to the end of the exisiting ‘Variable value’. Example:

    or, if you prefer

  • Finally, open a new command prompt to make this change take effect.

Note that MySQL’s documentation on Setting Environment Variables has little to say about handling this in Windows.

  1. Open the XAMPP control panel.
  2. Click Shell.
  3. Type mysql --user=your_user_name --password=your_password.


The reason that you can’t see the other tables is that you need to log in as ‘root’ in order to see them


I am running on windows 7 and had similar issue which I solved by:-

  1. Right click on the Computer icon on your Desktop and choose Properties option.
  2. In the System window click on Advanced system settings in the left pane as highlighted below
  3. In the System Properties window select Advanced tab and click on Environment Variables… button given at the bottom of the window as highlighted below
  4. In the Environment Variables window you will notice two columns User variables for a Username and System variables.
  5. Under System variables there is a Path variable, click edit
  6. At the end of the line, add where you installed your xampp, for my case it is: ‘;C:xamppmysqlbin’
  7. and finally click ok

Go to /xampp/mysql/bin
and find for mysql. exe

open cmd, change the directory to mysq
after write in cmd

Xampp Mysql Cmd

mysql -h localhost -u root


Xampp control panel v2.3.1
I got errors while using -h localhost

So, if you installed xampp as is and did not customize any documentroot, serverroot, etc. then the following works :-

start both the services on the xampp control panel
click shell
enter: # mysql -h -u root

that works just fine.
Below is the logtrail:-


mysql -h localhost -u root -p and enter root pw


To access SQL via the command line we simply navigate to the xampp folder.
the folder is usually on the c: drive.

  1. type: cd c:xamppmysqlbin then press enter.
  2. type: in mysql -u root -p then press enter.
  3. in the new line enter the password of the database.
  4. type: show databases; to see all the databases that you have access to.
  5. once you know what database you want to use type (ex. cms_database), type use cms_data or any other db_name, it should say Database changed

// Bonus Note
you shouldn’t use the root user when working with databases. you would want to create a separate account (ex. cms_user) with special privileges to limit errors.

to do that type:

double check by using the command:

if you already have the name of the user and the specific database you wish to use, change step 2 to this.


In terminal:

Hit ENTER if the password is an empty string. Now you are in.
You can list all available databases, and select one using the fallowing:

Remember about the “;” at the end of each SQL statement.

Windows cmd terminal is not very nice and does not support Ctrl + C, Ctrl + V (coppy, paste) shortcuts. If you plan to work a lot in terminal consider installing alternative terminal cmd line, I use cmder termianl – Download Page


You can access the MySQL command line with XAMPP for Windows

  1. click XAMPP icon to launch its cPanel

  2. click on Shell button

  3. Type this mysql -h localhost -u root and click enter

You should see all the command lines and what they do

Tags: mysql, sql, windows

Staying secure online has never been more important, especially for businesses. Password selection and maintenance both play an essential role in security. Unfortunately, they often get neglected, especially on local installations such as XAMPP.

However, local software can be just as vulnerable to malicious activity, and by default XAMPP typically ships without a root password for the MySQL database. Adding one and changing it regularly can help keep your data secure and prevent the loss of hours of hard work.

In this article, we’ll explain why you might want to change your XAMPP MySQL password. Then we’ll walk you through three different methods you can use. Let’s get started!

Why You Might Want to Change Your MySQL Password

There are several reasons why you might want (or need) to change your MySQL password. First and most important: when you install XAMPP on your computer, the password for the “root” user is left empty. This means that there is no security on this account by default.

The root user is essentially the administrator account—it has unrestricted access to all commands and files in the system. As such, having no password protection for this user is a major security hole. Anyone could log in to the user account and edit files on your local installation.

Apart from that, it’s also a smart security practice to change your passwords periodically. Doing so helps prevent malicious activity, particularly if you use the same password in multiple places. Regularly changing passwords can help offset issues that might arise without this practice.

Finally, you may have simply forgotten your password and, as a result, can’t access files or functions that you need on your local XAMPP WordPress installation. Whatever the reason, being able to change MySQL passwords is a valuable skill that could come in handy.

Looking for a powerful tool for local WordPress development? DevKinsta features one-click site creation, built-in HTTPS, powerful email and database management tools, and more. Learn more about DevKinsta!

How to Change Your MySQL Password in XAMPP (3 Methods)

As with most WordPress tasks, there are multiple ways to change the MySQL password. The method you should use will depend on exactly what you need to do and what interface you’re most comfortable with: the command line, a Graphical User Interface (GUI), or text files. With that in mind, let’s take a look at three ways to change your MySQL password in XAMPP.

1. Change Your MySQL Password Using the XAMPP Shell

Using the XAMPP shell is generally going to be the simplest and quickest method for changing your MySQL password. It does involve using the command line, which can seem daunting at first.

However, it’s actually fairly straightforward. This is also the method you’ll want to use if you’ve forgotten your existing MySQL password and need to reset it.

Note that these commands are the same whether you’re using Windows or macOS. Since this is a unique shell specific to XAMPP, any typical differences between the platforms won’t apply.

To get started, launch your XAMPP Control Panel and click on the Shell button on the right-hand side.

This will open up a new window with a command prompt. Enter the following command and press the Enter/Return key:

The shell will prompt you to enter a new password. Press Enter/Return again, and you’ll be asked to confirm the new password.

Once you’ve done that, you’re finished and can close the shell window.

Xampp Mysql Cmd Server

2. Change Your XAMPP MySQL Password via phpMyAdmin

The second method involves using the phpMyAdmin GUI to change your XAMPP MySQL password. This technique is relatively simple, but generally not as quick as the command line method.


First, you need to access the phpMyAdmin interface. Pull up the XAMPP Control Panel and click on Admin in the MySQL row:

Want to know how we increased our traffic over 1000%?

Join 20,000+ others who get our weekly newsletter with insider WordPress tips!

PhpMyAdmin will open in a browser window:

If you’re asked to log in, use the username “root” and enter your root password. If you haven’t set one yet, you can leave it blank.

Xampp Start Mysql From Cmd

Next, navigate to the User accounts section in the main menu bar, and locate the root user for localhost in the list:

Next, you can click on Edit privileges beside the root user, then select Change password at the top of the page.

On the next screen, simply enter the password you want to use:

When you’re finished, you can click on the Go button in the bottom-right to save the change. That’s it!

3. Change Your XAMPP MySQL Password by Editing the config.inc.php File

If you find yourself in a situation where you know your password is correct, but it isn’t working for whatever reason, this is the method for you. It involves opening up a text file and editing the password directly in it.

First, open the XAMPP Control Panel and click on the Explorer button on the right-hand side of the window:

This will launch a file browser in the XAMPP folder. Next, you can open the phpMyAdmin folder and locate the config.inc.php file:

The config.inc.php file in Windows.

You can open this file in your favorite text editor, or simply double-click on it to open it in the default program.

The line you’re looking for is $cfg['Servers'][$i]['password'] = 'YourPassword';. Here’s what it looks like:

Once you locate it, you can enter your desired password between the single quotes, and then save the file. That’s all there is to it!


Whether you’ve forgotten your XAMPP MySQL password or you want to take your security up a notch, there are multiple methods you can use to change it. Updating your password helps keep your data secure, and provides an additional layer of defense against malicious activity.

In this article, we covered how to change your MySQL password on an XAMPP installation using three methods, which include using the command line, going through the phpMyAdmin GUI, and editing a file directly. You can choose whichever one suits your workflow best.

If you take security seriously and want to ensure that all of your WordPress sites are protected, consider hosting with Kinsta. Our plans offer the security, speed, and support your site needs to operate at its best.

If you enjoyed this tutorial, then you’ll love our support. All Kinsta’s hosting plans include 24/7 support from our veteran WordPress developers and engineers. Chat with the same team that backs our Fortune 500 clients. Check out our plans