Setting up mysql and phpmyadmin on Mac OSX

well, I have been using MAMP for quite a long time. It’s a nice app. But then again, if I have native support on my own OS why use an third party app. Heh, actually I need this for some other reason.

Anyway, I am using Snow Leopard (little old though, don’t have money to buy the new one :P)

So, first download the latest version of .dmg from here.

Click mysql-5.5.19-osx10.6-x86_64.pkg (you may have different version) and install by following the screen.

Though this is optional, but I recommend to install MySQLStartupItem.pkg and run the MYSQL.prefPane as well. It will give you a MySQL panel on the System Preference. From here you can start/stop MySQL and also set for automated start upon server startup.

MySQL is accessible from /usr/local/mysql/bin/mysql

Set MySQL password for later use.

/usr/local/mysql/bin/mysqladmin -u root password SECRET

Installing phpmyadmin

Start Apache from System Preference (enable the web sharing). http://localhost should work now.

In Mac OSX PHP is not enabled by default. So enable PHP from /etc/apache2/httpd.conf by uncommenting the LoadModule php5_module        libexec/apache2/libphp5.so line.

Download phpmyadmin from here.

Extract the files into /usr/local/ directory and rename it to phpmyadmin

Copy the config.sample.inc.php and rename it to config.inc.php from the phpmyadmin directory.

Create a file into /etc/apache2/other/ and add the following lines

Alias /phpmyadmin /usr/local/phpmyadmin
<Directory /usr/local/phpmyadmin>
    Options Indexes
    Order allow,deny
    Allow from all
</Directory>

Restart Apache from terminal

apachectl restart

Open http://localhost/phpmyadmin/

tada!!!!

Folder path in Mac OS X

By default Mac OS X doesn’t give a folder path like we get in Windows. Sometimes I really felt the address bar I had in Windows. While I was googling for a address bar I found something really cool. I tried the cool trick and got it so perfect.
To activate folder path, go to Terminal and type:

defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES

To see the changed effect right away, type:

killall Finder

Now, open up Finder and see the change on the top of it. 😀
To get back to the default mood, type:

defaults write com.apple.finder _FXShowPosixPathInTitle -bool NO

and see! It’s gone! 😀

Setting up Virtual Host

Few days ago, while working on a project, I was in need of a vhost/virtual host. Then, I searched Google and found so many answers. I just didn’t know which one to try. All of them seems important. While working on my favorite lappy I tried most of those and now I forgot the places I edited.

However, I got a small process to make the thing done. I guess, when ever Name-based Virtual Host Support is needed, it’s gonna work.

I’ll be telling about *nix system.

From terminal.

sudo gedit /etc/apache2/httpd.conf

A new window is supposed to be visible. Go to the end of the file and paste the following lines or you can modify as needed.

<VirtualHost *:80>
	ServerName www.shaon.com
	DocumentRoot /www/shaon
</VirtualHost>

Then save and close this one and type on terminal,

sudo gedit /etc/hosts

put this your desired name for vhost just after localhost.

127.0.0.1	localhost
127.0.0.1   www.shaon.com

Now restart apache by typing

sudo /etc/init.d/apache2 restart

Name-based Virtual Host is now ready to go. 🙂 Check it on your browser.

VirtualBox full screen problem for ubuntu

start ubuntu on Virtualbox. go to terminal and type
cd /media/
sudo sh ./VBOXADDITIONS_3.2.6_63112/VBoxLinuxAdditions-x86.run

wait for the process to complete.
shutdown ubuntu and restart VirtualBox.
when ubuntu is started press command+F to full screen and command+L to get it back.

alias in unix

alias is probably the best option in order to save key strokes.

to make an alias
suppose I want to open htdocs folder which is in /Application/MAMP/htdocs/ , but for that i have to type few lines in terminal. But by making an alias it can be done with only one small word. To do so, just type this line in the terminal.
alias ht='open /Applications/MAMP/htdocs/'

to see the alias
just type
alias

to remove all aliases
unalias -a

to remove a specific one
unalias [name of the alias]