Getting MySQL path in command prompt

MySQLMySQLi Database

Let us understand how to get the MySQL path in the command prompt −

To invoke MySQL programs easily, the path name of the MySQL bin directory can be added to the Windows system PATH environment variable.

This can be done using the below mentioned steps −

Before trying to add MySQL to Windows path, ensure that MySQL has been installed properly.

Add MySQL to Path

Below are the steps to add MySQL to path −

Step1 − Locate the mysql.exe file. We found in the following location −

C:\Program Files\MySQL\MySQL Server 8.0\bin

Step 2 − Press Start and type “Environment Variables”. Click −

Step 3 − Under ‘Advanced’, click on ‘Environment Variables’ −

Step 4 − Locate the ‘System variables’ and double-click on “Path” −

Step 5 − Click on “New” −

Add the same path and click OK −

C:\Program Files\MySQL\MySQL Server 8.0\bin

The new PATH value should be available to any new command shell the user opens now. This will allow the user to invoke any MySQL executable program by typing its name at the DOS prompt from any directory on the system.

This means the user won’t have to supply the path. This includes the servers, the mysql client, and all MySQL command-line utilities such as mysqladmin and mysqldump.

The MySQL bin directory shouldn’t be added to the Windows PATH if the user is running multiple MySQL servers on the same machine.

Published on 10-Mar-2021 12:08:20