MAMP and CocoaMySQL

Discussion in 'Web Design and Development' started by Keith Knipling, Oct 27, 2006.

  1. Keith Knipling macrumors newbie

    Joined:
    Oct 27, 2006
    #1
    I am new to MySQL and PHP. Trying to set up a local Wordpress site and manage it. Cannot connect to the MAMP MySQL database with CocoaMySQL. I am using the beta version, which works with versions MySQL > 4.1.

    Thanks!

    Keith
     
  2. frankblundt macrumors 65816

    frankblundt

    Joined:
    Sep 19, 2005
    Location:
    South of the border
    #2
    I'm pretty sure I've used CocoaMySQL with MySQL 5. PhpMyAdmin is your other choice, which comes with MAMP and which gives you more controls over stuff like setting users and so on, but the interface isn't as pleasant.

    For CocoaMySQL you need to know the root password for MySQL for the utility to be able to connect to it (and MySQL needs to be running), so that you can enter Host: localhost , User: root, Password: <password> in the connection dialog.

    I believe for MAMP the root password is set to "root" by default,

    .. which you should change (using phpMyAdmin > Privileges > change password for root@localhost), although this may mean that MAMP can no longer connect to it, without altering some conf files :eek:
     
  3. Keith Knipling thread starter macrumors newbie

    Joined:
    Oct 27, 2006
    #3
    Here is a screenshot from phpMyAdmin, which says

    "MySQL 5.0.19 running on localhost as root@localhost"

    In CocoaMySQL I am trying to connect using localhost | user:root: password: root.

    Thoughts?
     

    Attached Files:

  4. frankblundt macrumors 65816

    frankblundt

    Joined:
    Sep 19, 2005
    Location:
    South of the border
    #4
    You should be able to change the root password from within PhpMyadmin (under the privileges section) to whatever you like. I just can't recall whether MAMP is smart enough to update itself when that happens to still have access to the MAMP database, but hopefully :p

    When you've set the root password you should be able to use that to connect via CocoaMySQL
     
  5. ddekker macrumors regular

    Joined:
    Sep 23, 2006
    Location:
    Michigan
    #5
    wordpress

    I found when I first started playing with MAMP servers and wordpress It went okay besides when I set the root password...lol... I just had the database named 'wordpress' and the password as '' (it was blank) and all was fine, I later in life figured out the whole root password and things... surely get phpmyadmin installed and working, I also found that you should get it going.. figure out how to change the mysql root password, I also placed PHPmyadmin in a directory with a .htaccess file so no one can get to it without another password, with no root password anyone can get in and screw with your SQL databases.... on the lighter side to it, once you get it going its a riot to play with (all the plugins and things).. I have my blog running on it, and a half dozen other sites just to help me learn..

    good luck

    DD
     
  6. Keith Knipling thread starter macrumors newbie

    Joined:
    Oct 27, 2006
    #6
    By default, MAMP does password protect MySQL. The default username is:
    User: root
    Password: root
    for the localhost.

    One can change this, but it involves changing other config files (I tried changing the database in phpMyAdmin, but then messed things up so MAMP could no longer communicate with the database. Ended up reinstalling MAMP).

    I would think CocoaMySQL should connect to the MAMP database using root and root as user and password, respectively. The MAMP database is password protected by default.

    Is the problem with the host? Is localhost correct? I tried "localhost" and "localhost:8888"

    Thanks.
     
  7. ddekker macrumors regular

    Joined:
    Sep 23, 2006
    Location:
    Michigan
    #7
    localhost is fine, sometimes you will see an internal ip (127.0.0.1) but either is fine... as far as being secure with "root" "root" I would sure try and get stronger sercurity than that.. trust me, i'm no sercurity expert...lol.. far from, I just found it amazing how many sites by browsing around I could get into their phpmyadmin area.. reminds me of seeing wireless access points named "linksys"..lol... no one ever changes their password...


    DD
     
  8. Keith Knipling thread starter macrumors newbie

    Joined:
    Oct 27, 2006
    #8
    But that is the problem. The "local host" used by MAMP is not localhost. If I type "localhost" in the browser window it points to my local Apache server set up in OS X.

    MAMP, by design, has a bundled Apache server that points to "localhost:8888." I want to access this to CocoaMySQL, but cannot seem to.

    I don't really care too much about the password issue, as I do not intend to let this see the Internet "light of day." Can anyone outside have easy access to the MAMP server anyway? The original intent of MAMP was as a local development server, not as a real server.
     
  9. frankblundt macrumors 65816

    frankblundt

    Joined:
    Sep 19, 2005
    Location:
    South of the border
    #9
    Either change the default port in MAMP to 3306 (for MySQL) and access MAMP's MySQL thru CocoaMySQL using the default localhost with the port field blank (it defaults to 3306 anyway)

    or set the port in CocoaMySQL to whatever the port is that MAMP sets for it (along with localhost, root, root)

    I forget whether the port setting is in Preferences or one of the tabs in the control panel in MAMP, but it's there somewhere.

    If you want to access the MAMP Apache through localhost (without adding the port), you'll need to set that to 80 in MAMP also (which won't work if you have Personal Web Sharing - OSX Apache - checked in Sys Prefs > Sharing)

    Still no go?
     
  10. Keith Knipling thread starter macrumors newbie

    Joined:
    Oct 27, 2006
    #10
    I tried both suggestions

    1. Using the dafault port in CocoaMySQL, and changing MAMP.
    2. Changing CocoaMySQL to port 8889, the default in MAMP.

    Attached are screenshots from the latter attempt. Still no luck - MySQL says it can't connect.
     

    Attached Files:

  11. frankblundt macrumors 65816

    frankblundt

    Joined:
    Sep 19, 2005
    Location:
    South of the border
    #11
    mysterious.
    it shouldn't affect anything, but do you have Firewall running?
    Do you have any other installations of MySQL running?
    MAMP itself is running fine? - the MySQL server starts up without issues and you can open the default MAMP page in Safari?
    Can you connect via PHPMyAdmin? What does it show on the main page?:

    MySQL - x.x.xx Complete MySQL by Server Logistics
    Protocol version: 10
    Server: Localhost via UNIX socket
    User: root@localhost

    If it is working, can you go to the privileges section and change the root password to "root"?
     
  12. Keith Knipling thread starter macrumors newbie

    Joined:
    Oct 27, 2006
    #12
    Here are screenshots of phpMyAdmin (off of the MAMP startup screen in Firefox).
     

    Attached Files:

  13. frankblundt macrumors 65816

    frankblundt

    Joined:
    Sep 19, 2005
    Location:
    South of the border
    #13
    In the Privileges section of PhpMyAdmin can you set the root password to root (just to make sure that's what it is).

    It's a bit strange that there are no databases listed to browse, I had thought MAMP created at least one for itself and MySql two (mysql and test)

    If CocoaMySQL is still not able to connect as root root to localhost on port 8889 I'd probably look at uninstalling and re-installing MAMP. Seems a bit screwy.
     
  14. Keith Knipling thread starter macrumors newbie

    Joined:
    Oct 27, 2006
    #14
    Here is the error from CocoaMySQL. I also took a screenshot from the phpMyAdmin panel. There are databases.
     

    Attached Files:

  15. jeremy.king macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #15
    Try this in the Socket field of your connect dialog (assuming you put MAMP in Applications)

    /Applications/MAMP/tmp/mysql/mysql.sock
     
  16. Keith Knipling thread starter macrumors newbie

    Joined:
    Oct 27, 2006
    #16
    /Applications/MAMP/tmp/mysql/mysql.sock

    HEY, THAT DID IT!

    Thanks so much.
     
  17. jeremy.king macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #17
    Where should I send the invoice? :D
     
  18. frankblundt macrumors 65816

    frankblundt

    Joined:
    Sep 19, 2005
    Location:
    South of the border
    #18
    There you go - wait long enough and someone who actually knows what they're talking about will eventually pitch in :p
     
  19. 7kire macrumors newbie

    Joined:
    Jul 21, 2007
    #19
    These config files are:
    /Applications/MAMP/bin/phpMyAdmin/config.inc.php @line 86
    /Applications/MAMP/bin/mamp/index.php @line 15
     
  20. kemitchell macrumors newbie

    Joined:
    Jul 24, 2007
    Location:
    Texas
    #20
    MAMP runs a very self-contained PHP install, which by default is set to go through the socket in /Apps.../MAMP rather than the default in /tmp. This bothered me to no end when trying to use phpsh to test some scripts id written in the MAMP environment.

    It is worth noting that if you have the admin password, you can run the MAMP apache and mysql servers on the default ports (check the MAMP prefs dialog).
     
  21. iKindred macrumors newbie

    Joined:
    Jul 4, 2008
    #21
    Thanks for the tip, was having the same issue. :)
     

Share This Page