Adding MySQL to Windows Path

MySQLMySQLi Database

Environment variables can be set at the command prompt. This is done to affect the current invocation of the command processor, or to permanently set to affect the future invocations. To set a variable permanently, it can be set in a startup file or with the help of the interface provided by the system for the same purpose. The documentation of the command interpreter needs to be consulted for specific details.

To specify a value for an environment variable, the syntax relevant for the command processor needs to be used.

The command to set environment variables can be executed at the command prompt which will take effect immediately, but the settings will last as long as the user is logged in. Once they log out, the changes are lost.

If the MySQL programs are installed in /usr/local/mysql/bin and the user wishes to make it easy to invoke these programs, the value of the PATH environment variable can be set to include that directory.

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.

Updated on 10-Mar-2021 12:06:51