Skip to main content

Installing MySQL and phpMyAdmin for web development on a Mac OS X 10.9, 10.8, 10.7, 10.6

This is a simple guide on installing a must have SQL database engine for web development. It is often used at the beginning of the journey and I did not find a good guide for it. That made me make myself one and share with others. Hope somebody would benefit from it.






First we need to setup the MySQL community edition (latest or not depending on your requirements). It's possible to download it here: http://dev.mysql.com/downloads/mysql/

It comes in form of a .pkg installer file. It is advised to install it as follows by using default settings. Installation is pretty straightforward. Just click next and agree several times...
This will add a service of MySQL to your system. Nothing more. To interact with it you need either to use SQL console (in case you know SQL) or install something like phpMyAdmin to interact with it. Your pkg installer installs a useful enough Preference Panel switch by default.
There you can have it basically configured. Only two basic options persist. Either to run the service on startup or start/stop service button.
Go ahead and start a service for farther interaction:
It is possible to now test your MySQL version by typing a terminal command:
/usr/local/mysql/bin/mysql -v
Good idea would be to add a path to your mysql executable to system path in your bash config. So you could type just "mysql" without specifying a path. To do so append this line to your ~/.bashrc_profile:
export PATH="/usr/local/mysql/bin:$PATH"
Either restart console or do source ~/.bash_profile to update your current environment.
It is now possible to do:
mysql -v
Note you do not have to specify a path to it any more.

Stoping at this no more farther let's finish configuring mysql by adding at least one main user/password and disabling defaults. There is a handy config script for this:
sudo mysql_secure_installation
Just execute this and follow up the steps widely described to you there. That's it you can now use MySQL on your system.

Let's go ahead and make a UI for ourselves by installing phpMyAdmin. Basically it's a utility that runs on your mac's built in Apache server (make sure it is running) and provides you an ability to manage your SQL databases through a handy web UI.

here you need to download a http://www.phpmyadmin.net/home_page/downloads.php latest version of the phpMyAdmin.
You will get yourself an archive version of this PHP application. that's basically all you need to know about it.
You also need to have apache running on your MAC. Make sure you do. zThere are many guides on it. Basically you need to have your computer outputting something in your web browser in case of typing localhost in your address line:
With this in mind you also need to have PHP enabled in your apache config. There are guides on that too. Enough of precautions and let's move farther with our straightforward install:
Time to place our unpacked folder contents into ~/Sites folder. It is advised to rename it into 'myadmin' to follow along with me.
This will bring you ability to type:
http://localhost/~your_username/myadmin/setup/ or either http://localhost/myadmin/setup/, depending on your apache configuration.
This will show up something similar to this:
Click New Server button and configure your newly installed MySQL server, so phpMyAdmin would be able to use it.
Fill in only username root and your root password, leaving all the other fields intact. (with default settings). You hopefully remember specifying a password for root in the initial MySQL server configuration step?
Switch to the Authentication tab and enter them.
Now you are able to manage your MySQL databases through a web UI using phpMyAdmin
Type in the address like: http://localhost/~username/myadmin/

Here you go... Please comment in case you have found it useful. I will know my time writing this was not wasted. thank you!

Comments

  1. The (only) reason I am still in the MySQL camp after thirteen years is that every time I try to install PostGreSQL on Debian Linux and use it, it feels like an exercise in masochism. The environment is endlessly pedantic and bureaucratic with misleading error messages that would make a K&R C compiler blush. Thanks.

    Steve R.

    ReplyDelete

Post a Comment

Popular posts from this blog

Pretty git Log

SO you dislike git log output in console like me and do not use it... Because it looks like so: How about this one? It's quite easy... Just type: git log - - graph - - pretty = format : '%Cred%h%Creset -%C ( yellow ) %d%Creset %s %Cgreen ( %cr) %C ( bold blue ) <%an>%Creset' - - abbrev - commit - - It may be hard to enter such an easy command every time. Let's make an alias instead... Copypaste this to your terminal: git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --" And use simple command to see this pretty log instead: git lg Now in case you want to see lines that changed use: git lg - p In order for this command to work remove  the -- from the end of the alias. May the code be with you! NOTE: this article is a rewritten copy of  http://coderwall.com/p/euwpig?i=3&p=1&t=git   and have b...

Django: Resetting Passwords (with internal tools)

I have had a task recently. It was about adding a forms/mechanism for resetting a password in our Django based project. We have had our own registration system ongoing... It's a corporate sector project. So you can not go and register yourself. Admins (probably via LDAP sync) will register your email/login in system. So you have to go there and only set yourself a password. For security reasons you can not register. One word. First I've tried to find standart decision. From reviewed by me were: django-registration and django password-reset . These are nice tools to install and give it a go. But I've needed a more complex decision. And the idea was that own bicycle is always better. So I've thought of django admin and that it has all the things you need to do this yourself in no time. (Actually it's django.contrib.auth part of django, but used out of the box in Admin UI) You can find views you need for this in there. they are: password_reset password_reset_...

Vagrant error: * Unknown configuration section 'hostmanager'.

Sometimes you get a vagrant environment or boilerplate with a Vagrantfile config in there and do a vagrant up command. And see some errors. like this: There are errors in the configuration of this machine . Please fix the following errors and try again : Vagrant: * Unknown configuration section 'hostmanager'. To fix this one needs: $ vagrant plugin install vagrant - hostmanager Installing the ' vagrant-hostmanager ' plugin . This can take a few minutes . . . Fetching : vagrant - hostmanager - 1.8 .6 . gem ( 100 % ) Installed the plugin ' vagrant-hostmanager (1.8.6) ' ! So command to fix this as follows: vagrant plugin install vagrant-hostmanager