How to run mysql commands from terminal on a MAMP install? - php

I just installed mamp (xampp) from the mamp.info page and it is working on my mac (both apache, php, phpmyadmin, and mysql). The only problem is when i try to run
mysql -u root -p
Which connects to mamp from the mac os terminal, i get a command error. I have installed and uninstalled mamp and xampp for mac multiple times to no avail.
I am following this tutorial; http://www.raywenderlich.com/2941/how-to-write-a-simple-phpmysql-web-service-for-an-ios-app and i can't get past a certain part because i don't want to use php admin, and i think it'd be cool to use it from the terminal.
My question; how do i configure mamp or xampp for mac to work from the terminal?

Put this at the end of your .bash_profile script (create it if it doesn't already exist):
export PATH=$PATH:/Applications/MAMP/Library/bin

Related

How to properly install Xampp on Mac in order to run PHP code

I downloaded the installer version of Xampp version 8.1.6-0 for Mac and went to the manager-osx widget to start the Apache and MySQL servers but neither would start.
I then tried using the command sudo apachectl start and then created an index.php file and put it in htdocs, and then tried to open it using http://localhost/index.php as well as http://localhost:8080/index.php and both times it said the server could not be reached.
I've actually downloaded Xamp in the past and was able to reach the server but wasn't able to get php scripts to run, but now for some reason I can't even get the server to run.
I made sure to download the installer and not the virtual machine version. I'm running Monterey version 12.4.
I tried the solutions here but they didn't seem to work. I checked my activity monitor and nothing is running on port 80.
I also installed MAMP from here and tried to start Apache but it displayed the error:
"Apache couldn't be started. Please check your MAMP installation and
configuration."
Any help would be appreciated as I just want to run PHP.

Execute export command in windows

Hello I am trying to execute this command:
export PATH="$HOME/.composer/vendor/bin:$PATH"
in windows.
Please, check these notes
Note: For the local PHP environment I am using a Mac and Valet because it automatically sets up everything. If you are on Windows, you should consider Homestead or some flavor of a virtual machine.

Changing mac php path to windows xampp php

I am having problem in running php in mac terminal. My scenario is I am using xampp which is actually shared from windows. Now I want to use cakephp bake commands in my mac terminal.How can I do this?
I have tried using export path="/volumes/xampp/bin:$PATH"
But I am unable to do it.
How can I change /usr/bin/php to /volumes/xampp/bin/php?

how can I run mysql if I installed it from MAMP

So I looked at this question Find out where MySQL is installed on Mac OS X
I have MAMP installed and when I run: /Applications/MAMP/Library/bin/mysql --version It gives me correct output for mysql version.
But if I run type -a mysql it says that it wasn't found, as if I don't have mysql installed.
If I want to run mysql from the terminal I can start my MAMP server, then go to MAMP's library and run ./mysql which will start a mysql session.
HOWEVER: I do NOT want to run it using the current MAMP's server I have. i.e Is there a way to run mysql from any directory, like without using MAMP at all?
I downloaded mysql from mysql site http://www.mysql.com and I can run either the one on my MAMP'S server or the one locally on my machine. I just need to decide which of the two since both are running locally.
you should run the daemon manually but you need to setup the data before that by doing something like data directory initialization mysqld

I can not configure MySQL to run from terminal with MAMP

I installed MAMP successfully and it works just fine, apache, phpMyAdmin, etc...and followed a tutorial video on youtube on how to configure MySQL so I can use it with terminal. In short, I created a
.profile
file in my home directory with this data in it:
PATH=$PATH:/Applications/MAMP/Library/bin
export PATH
When I shut everything down and restarted the server and terminal and typed mysql in terminal, this is what I get:
-bash: mysql: command not found
Does anybody have any idea what my problem might be? I'm using MAMP 2.0.
Any help would be appreciated.

Categories