Emusen
Emusen

Reputation: 11

Trouble with MySQL on Windows 10 (php, MySQL, MAMP)

I'm currently learning php through Laracasts and I'm loving it so far, but I'm having trouble connecting to the MySQL database.

Since I'm using Windows 10 I have set up an Apache server through MAMP, and along with it there's a MySQL DB. In Laracasts' The PHP Practitioner: MySQL 101 Jeffrey is using the command line to enter / customize MySQL, however, when I try to do so with Git Bash I get this message:

bash: mysql: command not found

How can I access this database and do what Jeffrey is doing at the 2:40 minute mark?

Any help with understanding this is greatly appreciated, and if you need any more information, please do not hesitate to ask.

Upvotes: 1

Views: 2963

Answers (1)

Faisal Umair
Faisal Umair

Reputation: 391

The MAMP bundle includes mysql but it is not added to the PATH environmental variable searched by command prompt or git bash when you input your command mysql

In order to access the mysql executable included in the MAMP package, you can manually visit the folder containing the mysql executable.

or

What you can do is add the path of the mysql executable to the PATH environmental variable and then you will have access to mysql command from any folder.

Assuming your MAMP installation is in C:\MAMP\

You can change directory to C:\MAMP\bin\mysql\bin using cd C:\MAMP\bin\mysql\bin and run mysql command afterwards.

Alternatively, you can add the same path C:\MAMP\bin\mysql\bin to the environmental variable PATH and access mysql from any folder.

Upvotes: 2

Related Questions