OS X and MySQL

Posted:
in macOS edited January 2014
What does OS X come pre-installed with in relation to MySQL. I want to start getting in to database programming, but don't know what OS X provides for me. Using the mysql command gets me a no command error. Do I have to install somthing extra, download something? Or am I missing something entirely?

Comments

  • Reply 1 of 4
    torifiletorifile Posts: 4,024member
    OS X client doesn't have mysql preinstalled. You can do a couple things: download and compile the source code (icky.) or download a binary from entropy.ch (yay!!). It works great.



    PHP is preinstalled, but not configured to work out of the box. There are a couple lines you need to add to the httpd.conf to get it working. It's really a piece of cake though.



    Once you get those two working, you should be all set. If you're going to be doing db stuff, you might as well get phpmyadmin to make life easier. HTH.



    edit: apparently, there is now an official mysql binary for OS X on the mysql.com page. Cool.
  • Reply 2 of 4
    drcreationsdrcreations Posts: 104member
    Here you go - PHP install:



    Installation Instructions

    This module requires Mac OS X 10.2. It will not run on any 10.1 system.



    Starting with Mac OS 10.1, Apple includes a working PHP module in the default installation.

    Apple's version provides far fewer features (no GD, only MySQL DB support etc.) but will probably consume less memory.



    If you want to use my module from this page (i.e. more features), do this first, otherwise proceed directly to "Activating the Module":



    Open a terminal window

    type "curl -O http://www2.entropy.ch/download/libphp4.so.gz", wait for download to finish

    type "gunzip libphp4.so.gz"

    type "sudo mv libphp4.so /usr/libexec/httpd/"

    Activating the PHP Module

    Open a terminal window

    type "cd /etc/httpd"

    type "sudo apxs -e -a -n php4 libexec/httpd/libphp4.so"

    On OS X prior to 10.2, type

    sudo perl -p -i.bak -e 's%#(AddType \\S+-php[ -])%$1%i' httpd.conf

    On OS X 10.2, type

    echo 'echo "AddType application/x-httpd-php .php" >> /etc/httpd/httpd.conf' | sudo sh -s



    (Note: Don't type this by hand, do a copy/paste from this web page directly to the terminal)



    Finally, type "sudo apachectl graceful" to restart the web server



    PHP should now be up and running. You can test it by dropping a file into your "Sites" folder which is called "test.php". Into that file, write this line: "<?php phpinfo() ?>".



    Now open up 127.0.0.1/~your_username/test.php in your web browser.

    You should see a status table with information about the PHP module.





    --------------------------------------------------------------------------------



    Update Instructions

    If you previously installed an older version of the module, here is what you have to do to update to the most recent version:



    Open a terminal window

    type "curl -O http://www2.entropy.ch/download/libphp4.so.gz", wait for download to finish

    type "gunzip libphp4.so.gz"

    type "sudo apxs -i -a -n php4 libphp4.so"

    type "sudo apachectl graceful" to restart the webserver
  • Reply 3 of 4
    inkheadinkhead Posts: 155member
    Why not just go to aaronfabby.com and download the binary install packages? Unless your doing some major tweaking and hardcore hacking it installs them for you automagically.
  • Reply 4 of 4
    toweltowel Posts: 1,479member
    Quote:

    Originally posted by inkhead

    Why not just go to aaronfabby.com and download the binary install packages? Unless your doing some major tweaking and hardcore hacking it installs them for you automagically.



    The offical MySQL install is just about that easy. It's a double-click installer now. MySQL works fantasmogenically under OSX for me. I only started learning it a few months ago, but now I couldn't live without it.
Sign In or Register to comment.