• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Trying to use Mac for proper work

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Trying to use Mac for proper work

    Does anyone run MySQL on Mac?

    Tried to set up a MySQL instance on my Mac tonight to play with some postcode data. Gone to the MySQL downloads section at http://www.mysql.com/downloads/mysql/ and installed the (Mac OS X ver. 10.6 (x86, 32-bit), DMG Archive) Community Server package and then installed the Workbench GUI.

    The Workbench tool wont work as it says "Operation failed: File /etc/my.cnf doesn't exist"

    The MySQL server is running ok as i've looked up the bollox 'sudo /Library/StartupItems/MySQLCOM/MySQLCOM start' command to ensure the thing is running.

    It suggests that this installer should have created some sort of .cnf file but it doesn't, i don't have a my.cnf anywhere on the Mac.

    This is what really annoys me when people knock Windows, i really like my Mac but having set up MySQL and Workbench numerous times on Windows, its just a case of double clicking, it works and i can then get on with doing my work.

    Anyone know the score with these .cnf files? It suggests the installer should create examples like my-large.cnf but these don't exist either.

    Ta

    Edited, if its any help, what i see is:

    Checking command 'ps xa | grep "/usr/local/mysql/bin/[m]ysqld"'
    Server detected as running
    Check if /etc/my.cnf exists locally
    Operation failed: File /etc/my.cnf doesn't exist

    (but as i say, my.cnf doesnt exist at all on the machine - have i missed some step where you need to manually create this?)
    Last edited by Durbs; 21 March 2010, 00:13.

    #2
    Best to download MAMP - there a free and paid for, both sort out MySQL without woes.

    http://www.mamp.info/en/index.html

    Comment


      #3
      I run MySQL on the Mac, and have done for years.

      locate my.cnf shows me that my copy is in /private/etc. I don't remember creating it myself.

      EDIT: it appears that /etc is just a symlink to /private/etc.
      Last edited by NickFitz; 21 March 2010, 18:41.

      Comment


        #4
        Here's an example one i found with a 5 sec google:

        Code:
        # Example MySQL config file for large systems.
        # Added support for very large database (>4GB) and
        # packets (>1MB) in order to import the Wikipedia
        # database dumps.
        #
        # You can copy this file to
        # /etc/my.cnf to set global options,
        # mysql-data-dir/my.cnf to set server-specific options (in this
        # installation this directory is /usr/local/mysql/data) or
        # ~/.my.cnf to set user-specific options.
        
        # The following options will be passed to all MySQL clients
        [client]
        #password	= your_password
        #port		= 3306
        socket		= /tmp/mysql.sock
        
        # Here follows entries for some specific programs
        
        # The MySQL server
        [mysqld]
        #port		= 3306
        socket		= /tmp/mysql.sock
        skip-locking
        key_buffer = 256M
        max_allowed_packet = 256M
        table_cache = 256
        sort_buffer_size = 1M
        read_buffer_size = 1M
        read_rnd_buffer_size = 4M
        myisam_sort_buffer_size = 64M
        thread_cache = 8
        query_cache_size= 16M
        # Try number of CPU's*2 for thread_concurrency
        thread_concurrency = 2
        myisam_data_pointer_size = 7
        
        # Don't listen on a TCP/IP port at all. This can be a security enhancement,
        # if all processes that need to connect to mysqld run on the same host.
        # All interaction with mysqld must be made via Unix sockets or named pipes.
        # Note that using this option without enabling named pipes on Windows
        # (via the "enable-named-pipe" option) will render mysqld useless!
        # 
        skip-networking
        
        # Replication Master Server (default)
        # binary logging is required for replication
        log-bin=mysql-bin
        
        # required unique id between 1 and 2^32 - 1
        # defaults to 1 if master-host is not set
        # but will not function as a master if omitted
        server-id	= 1
        
        # Point the following paths to different dedicated disks
        #tmpdir		= /tmp/		
        #log-update 	= /path-to-dedicated-directory/hostname
        
        [mysqldump]
        quick
        max_allowed_packet = 256M
        
        [mysql]
        no-auto-rehash
        max_allowed_packet = 256M
        # Remove the next comment character if you are not familiar with SQL
        #safe-updates
        
        [isamchk]
        key_buffer = 128M
        sort_buffer_size = 128M
        read_buffer = 2M
        write_buffer = 2M
        
        [myisamchk]
        key_buffer = 128M
        sort_buffer_size = 128M
        read_buffer = 2M
        write_buffer = 2M
        
        [mysqlhotcopy]
        interactive-timeout
        Just create a my.cnf in /etc/ and copy the above in.

        Job done.

        Comment


          #5
          Thank you chaps.

          Getting there. Ran that locate thing - cheers Nick, is handy that, didn't work at first until i ran:

          sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

          And it took a while to create the DB but it now shows i do have my.cnf's under

          /usr/local/mysql-5.1.45-osx10.6-x86/mysql-test/include/default_my.cnf
          /usr/local/mysql-5.1.45-osx10.6-x86/mysql-test/suite/federated/my.cnf
          /usr/local/mysql-5.1.45-osx10.6-x86/mysql-test/suite/ndb/my.cnf
          /usr/local/mysql-5.1.45-osx10.6-x86/mysql-test/suite/rpl/my.cnf
          /usr/local/mysql-5.1.45-osx10.6-x86/mysql-test/suite/rpl_ndb/my.cnf

          Tried these and also Ardesco's copy and it now gets further but it moans about missing sections:

          Checking command 'ps xa | grep "/usr/local/mysql/bin/[m]ysqld"'
          Server detected as running
          Check if /etc/my.cnf exists locally
          File was found in expected location
          Check if section for instance mysqld exists in /etc/my.cnf
          Operation failed: Couldn't find section mysqld in the config file /etc/my.cnf

          Thing is, i can see a 'mysqld' section in Ardesco's file but it cant. I'm sure i'll get there, will have a play later and if nothing else, at least i'm getting to know my Mac better as normally just use it for emailings and intrawebbings.

          That MAMP thing indeed looks good. May try that if all else fails but don't really need the 'A' and 'P' bits.

          Comment


            #6
            Originally posted by Durbs View Post
            That MAMP thing indeed looks good. May try that if all else fails but don't really need the 'A' and 'P' bits.
            Your Mac already has the "A" and "P" bits anyway, for all three values of "P"

            (PHP, Perl, and Python since you ask.)

            Comment


              #7
              I can't remember where I got my installation of MySQL, but my locate command shows similar output to yours. Note by default locate only gets run on a Saturday morning (it runs off a database which is created weekly).

              My installation of MySQL put an icon into System Preferences > Other and from there I can start and stop it, or set it to run automatically on startup.

              Quick frig for updating the locate db on demand (e.g. after installing a pile of new stuff) is

              Code:
              sudo periodic weekly
              but be aware that that will rotate your log files as well.
              Behold the warranty -- the bold print giveth and the fine print taketh away.

              Comment


                #8
                No idea about Mac but an updatedb normally refreshes the locate indexes on a Linux box.

                I would suggest looking at the file in a command line text editor to see if it looks correct (something like vi /etc/my.cnf don't know if Mac's come with vi though). If you copied and pasted from above it may have put in invalid carriage returns or something silly that is stopping MySQL from reading it properly. It should be instantly obvious if this has happened when you look at the file.

                Comment


                  #9
                  Originally posted by Ardesco View Post
                  No idea about Mac but an updatedb normally refreshes the locate indexes on a Linux box.

                  I would suggest looking at the file in a command line text editor to see if it looks correct (something like vi /etc/my.cnf don't know if Mac's come with vi though). If you copied and pasted from above it may have put in invalid carriage returns or something silly that is stopping MySQL from reading it properly. It should be instantly obvious if this has happened when you look at the file.
                  OS X is based on FreeBSD, so it has all the usual Unix stuff like vi; however, there are some things that are different to Linux because of the different branches in the Unix family tree.

                  I think the locate database can be updated using the bash script at /usr/libexec/locate.updatedb (which appears to be part of the FreeBSD distribution judging by the copyright and comments). Of course it's always possible that some other way of doing it has also been added. There's a man page for it, available by typing man locate.updatedb in Terminal, or using your favourite GUI-based man page reader (I use ManOpen).

                  Comment


                    #10
                    Originally posted by NickFitz View Post
                    OS X is based on FreeBSD, so it has all the usual Unix stuff like vi; however, there are some things that are different to Linux because of the different branches in the Unix family tree.

                    I think the locate database can be updated using the bash script at /usr/libexec/locate.updatedb (which appears to be part of the FreeBSD distribution judging by the copyright and comments). Of course it's always possible that some other way of doing it has also been added. There's a man page for it, available by typing man locate.updatedb in Terminal, or using your favourite GUI-based man page reader (I use ManOpen).
                    I'm aware they are *nix based and have poked around on one a couple of times for various test related things but I've never really used a Mac in anger hence my knowledge is limited

                    Comment

                    Working...
                    X