[Solved] MySQL is not recognized as an internal or external command

Advertisement

You may see sometimes the error: ‘mysql’ is not recognized as an internal or external command, operable program or batch file.

Something as in the below screenshot:

[Solved] MySQL is not recognized as an internal or external command 1
‘mysql’ is not recognized as an internal or external command, operable program or batch file.

Here, The issue is the mysql.exe is not set up on your Windows Operating System.

You just need to follow the below simple steps to execute the MySQL command on the terminal/CMD.

‘mysql’ is not recognized as an internal or external command,
operable program or batch file.

MySQL is not recognized as an internal or external command.

We know that MySQL is a server-side scripting language.

But, Most of the time we face an issue:

[Solved] MySQL is not recognized as an internal or external command 2
[Solved] MySQL is not recognized as an internal or external command 8

Step 1: Open System Properties Step 1: Open System Properties

  • Click on the Start menu from Windows Operating System
  • Search for Environment Variables
  • Then click on Environment Variables

You will see something as below

[Solved] MySQL is not recognized as an internal or external command 3
System Properties

Top ↑

Step 2: Add System Variables Step 2: Add System Variables

You add the MySQL file path in either the System variables or User Variables

  • System variables – If we add a path in system variables then other system users also use MySQL through the command line.
  • User variables – If we set the path for the current user then only the current user can execute the MySQL through the command line.

You can add the PATH as per your requirement.

[Solved] MySQL is not recognized as an internal or external command 4
Environment Variables and System Variables

Top ↑

Step 3: Add MySQL.exe File Path Step 3: Add MySQL.exe File Path

I have a Xampp, but somehow the environment variable not working.

You may have a different place for the mysql.exe file.

You need to find it and set it in Environment Variable Path as below:

[Solved] MySQL is not recognized as an internal or external command 5
C:\xampp\mysql\bin

Here, My mysql.exe file exists in the C:\xampp\mysql\bin directory.

So, I’m adding this path as:

[Solved] MySQL is not recognized as an internal or external command 6
System Properties Advanced

That’s it.

Top ↑

Done! MySQL is working now Done! MySQL is working now

To confirm that MySQL is now working just execute the below command:

mysql --version

E.g.

[Solved] MySQL is not recognized as an internal or external command 7
mysql –version

%d bloggers like this: