301

professional dilettante

mysql install, mac os x leopard

**Update: If you already have MAMP installed, you can just use the MAMP MySQL which is at /Applications/MAMP/Library/bin/mysql Socket (if MAMP is running) is at:/Applications/MAMP/tmp/mysql/mysql.sock I had previously read that using MAMP’s mysql DB with Rails was a problem. But it works for Sinatra at least.** Installing mysql without macports. Posting these instructions b/c I [...]

**Update: If you already have MAMP installed, you can just use the MAMP MySQL which is at /Applications/MAMP/Library/bin/mysql
Socket (if MAMP is running) is at:/Applications/MAMP/tmp/mysql/mysql.sock
I had previously read that using MAMP’s mysql DB with Rails was a problem. But it works for Sinatra at least.**

Installing mysql without macports. Posting these instructions b/c I just had to install mysql on my new work machine and I’d forgotten how since the last time I’d installed it.  Before we get started, here’s a great mysql resource http://www.pantz.org/software/mysql/mysqlcommands.html.

1) download the dmg from http://dev.mysql.com/downloads/

2) Quit out of MAMP and try to confirm no other mysql processes are running. Do this by typing

top

in your terminal. Look for a process called “mysqld”. If you find a process, and are certain you’ve not installed mysql, and you’re certain you’ve quit MAMP, you can a) run a grep to find this process b)

sudo kill -9 PID

where PID is the process ID number of whatever mysqld you find when you do

top

.

2a) With no mysql processes running, double click the dmg and run the install and use the defaults.

3) add preference pane ( should be an executable file when you open the .dmg package).

4) add start up item ( another executable file when you open the .dmg package).

5) Start mysql
default install is to

/usr/local/mysql/bin/

So we can do:

sudo /usr/local/mysql/bin/mysqld_safe &

6) You can now log-in by doing:

/usr/local/mysql/bin/mysql

7) Instead of typing the above path everytime you want to log-in to mysql, add the path to mysql to your .bash_profile in your home directory ( ~/ )
e.g.

PATH=$PATH:/usr/local/mysql/bin

Lastly, if you’re doing Ruby on Rails development, you may need to know the location of your mysql.sock file in order to properly configure config/database.yml. The file is often stored in /private/tmp/mysql.sock.  Update: You can confirm the location of the file by doing

mysql_config --socket

***************IMPORTANT!

This mysql.sock file is only present if the mysql process is running. And it has to be the correct mysql process. If you’re using MAMP or something else, you’ll want to quit out of that app before searching for the mysql.sock. You can check and confirm mysql is running by a) trying to log-in b) type

top

in your terminal to view all processes. Make sure mysql is running before you spend time looking for the .sock file!

Create a root user and set pw. Finally, to use mysql you’ll need to create a root user and set the password. Do so like this, from the terminal, not logged in to mysql, type:

mysqladmin -u root

This creates a user “root” and sets no password. If you want to set a password, do the above and add your password on to the end of the command.

Again, this site is a tremendous tremendous mysql resource http://www.pantz.org/software/mysql/mysqlcommands.html

One Response

You can follow the comments for this article with the RSS 2.0 feed.

blah blah blah
sql this sql that

1 gu September 02, 2009 12:12 pm

Leave a Reply

Required fields are marked with an asterisk (*), you may use these tags in your comment: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam protection by WP Captcha-Free

Most Recent Post

It’s been a long time, I shouldn’t have left you, part 1 …

But now I’m back.All official like.I do social stuff again.I see my friends.I’m moving into my own place again.And all that adult shit.

Categories

Content © professional dilettante
Proudly powered by WordPress
Theme designed by Artisan Themes

Entries (RSS)
Comments (RSS)

22 queries.
0.544 seconds.