mac - How do I run a PHP script through SSH using MAMP?

01
2013-08
  • chris

    I have a PHP socket script that I run from SSH on a remote dedicated server, but I want to try doing that using MAMP with SSH.

    I have MAMP configured and am running a remote web server on port 80. I also have remote login enabled in sharing in system preferences and am able to SSH into localhost.

    Once I SSH into localhost, I can't do much; the current directory seems empty. How can I get to my PHP file from there and open it so the socket runs?

  • Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.


    view all most popular Amazon Coupons
    .

    Related Question

    mac - I just installed MAMP. How do I access mysql through the terminal?
  • Questioner

    I'm trying to figure out how I can start using mysql through terminal since I'm not much of a fan for phpmyadmin.

    I read online where that told me to type this into terminal

    /Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot
    

    and I did and received this

    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
    

    I've already setup the permissions through phpmyadmin

    What can I be doing wrong, the guy in the tutorial didn't say that I had to include my login/pass anywhere in that link, I also did try including my login/pass and it still wouldn't work, it wouldn't execute, just display the help page for mysql.

    What's a good third party application that would let me create tables, and work with MySQL? When I was using Windows I would use mysql maestro and it would do the job really well. Since I'm new to the Mac, what is out there?


  • Related Answers
  • Tomas Markauskas

    Try --host=127.0.0.1 because the mysql client is trying to connect using the standard mysql socket (/tmp/mysql.sock). Specifying an IP address won't use this socket connection. I had to change this in every program to be able to connect to the MAMP database, including Sequel Pro.

  • MDMarra

    I suggest using Sequel Pro for all your Mac SQL DB GUI needs.

    As for why your access is deined,

    • Can you login to phpMyAdmin using root/root?
    • What happens when you leave off the --host= portion?
  • dcneiner

    You should leave off the --host part or add --port=8889 but don't use just --host. By including --host without --port you might be trying to connect to another MySQL installation running at the default 3306.

    It is possible that you changed the mysql root password during installation. Typing it this way will prompt you for your password, or you could enter the changed password as needed:

    /Applications/MAMP/Library/bin/mysql -uroot -p
    

    Also, Sequel Pro is one of the nicest free solutions for the Mac. I use it all the time. To connect to MAMP with Sequel Pro, use the following settings:

    host: 127.0.0.1

    user name: root

    password: root (or if you changed it, whatever that is)

    port: 8889

  • Kaji

    Good luck, I tried to get MAMP to work and gave up on it. Nothing worked trying to get MySQL up and running on my machine until I installed XAMPP, which was surprisingly painless and trouble free. No additional configuration required once you have it set up, except for using its control panel application to start and stop the components you want to run at the moment.

  • Ivan Chaer

    Just posted on Stack Overflow a solution for a similar problem. Thought it might help someone to post it here as well.

    I was trying to access MAMP's MySQL through the terminal on Mountain Lion, and getting the same ERROR 1045 (28000).

    The --no-defaults flag solved it for me.

    /Applications/MAMP/Library/bin/mysql --no-defaults -u root -proot -h localhost