"'mysql' is not recognized as an internal or external command, operable program or batch file solution appears

Log in to MySQL through the command line in the DOS window of the Windows system. The prompt "'mysql' is not recognized as an internal or external command, operable program or batch file" appears, which means that the system cannot recognize or cannot find the MySQL executable. document . This may be due to several reasons:

  1. MySQL is not installed correctly: Make sure MySQL is installed correctly and added to the system's environment variables.

  2. Environment variable configuration error: The installation path of MySQL is not correctly added to the system's environment variables, causing the system to be unable to find the MySQL executable file.

The solution is as follows:

  1. Check MySQL installation: First, make sure MySQL is installed correctly. If it is not installed yet, please follow the official documentation or installation instructions for proper installation. (For installation tutorial, you can refer to my previous blog post    MySQL Installation Tutorial (including software download address and installation tutorial) )

  2. Check the environment variable configuration:

    1. Open Control Panel, select System, and then select Advanced system settings.

    2. In the window that opens, select the "Advanced" tab and click the "Environment Variables" button.

    3. In the "System Variables" list, find the variable named "Path" and double-click it to edit it.

    4. In the edit window, make sure that the MySQL installation path is added to the end of the variable value, using a semicolon (;) to separate multiple paths.

    5. Confirm and save changes.

  3. Restart the command line window: If MySQL has been opened in the command line, you need to close the current window and reopen a new window to allow the system to load and recognize the changes to the environment variables.

  4. Verify the MySQL command: In the newly opened command line window, enter the "mysql" command. If the same error message still appears, try reinstalling MySQL and make sure to select the Add to environment variables option during the installation process.

If the above method still cannot solve the problem, it is recommended to refer to the MySQL official documentation ! ! !

        

Guess you like

Origin blog.csdn.net/Sunny_Boy0518/article/details/132945084