Fixing ‘mysql’ is not recognized as an internal or external command in Windows7

Having WAMP installed when i try to type mysql in my windows command prompt it would give me the following error:

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

This simply means that the ‘mysql’ excutable command file (mysql.exe) was not added to your system path therefore the system was unable to locate this file. To add the ‘mysql’ to system path try to locate the ‘mysql’ resident folder. In my case (Windows7) it was

C:\wamp\bin\mysql\mysql5.1.36\bin

Copy it (to clipboard) and go to Control Panel -> System and Security -> System and paste the copied folder path into Variable value: field of Edit System Variable pop up. Prefix it with a semi-colon (;) to separate it from other existing values (see image below – click to open larger image)

Fixing 'mysql' is not recognized as an internal or external command in Windows7

Restart the command prompt and typing ‘mysql’ should work now.

14 thoughts on “Fixing ‘mysql’ is not recognized as an internal or external command in Windows7

  1. i am using windows xp os please help me on below error…

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

    1. do it same for xp..go to my computer—>Properties—>Environmental Variables—->Advanced—>and set values as above..

  2. Hi,
    I knew that this was the way to go, but now that I’ve installed MAMP in a different disk (E: instead of C:) it’n not working anymore
    Is this the problem or I’m adding the path to the local variables in a wrong way ?
    Thanks

    1. Sorry,
      I fixed it …
      There was still the variable of the previous installation !

      Seems that this forum inspired me :D !

  3. Thanks for the help, but that took me to another error at the command prompt:
    Warning: Using a password on the command line interface can be insecure. ERROR 1405 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)

  4. I’m using windows XP , and I did that, but the problem still exists, Can you help me please ?

    note: I’m sure that mysql is installed in my machine, and i accessed the mysql from mysql.exe, but the problem with me as I think is the system still can’t access the database I’ve made by phpMyAdmin, maybe I know this because of the following:

    while ($row = mysql_fetch_assoc($result))
    {
    echo $row[‘product’];
    }
    this code gave me this output:

    Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\Program Files\EasyPHP-12.1\www\PHP&MySQL\dbconnect.php on line 14

    and when I added the word resource before $result, the output became:

    Parse error: syntax error, unexpected ‘$result’ (T_VARIABLE) in C:\Program Files\EasyPHP-12.1\www\PHP&MySQL\dbconnect.php on line 14

    and I’m sure that I wrote here the proper database information like what I did in phpMyAdmin

    I guess the Apache server handled with the variable $result like any other variable.

    please help me

Leave a Reply