Web Server @ Home – Installing MySQL

Web Server @ Home is where this series commenced. This is follow up in same series. Please read it if you want to know motivation behind this discussion.

MySQL is the one of the best Database Server out there. And it is free too!! According to MySQL Official Site (http://www.mysql.com),

The MySQL® database has become the world's most popular open source database because of its consistent fast performance, high reliability and ease of use. It's used in more than 8 million installations ranging from large corporations to specialized embedded applications on every continent in the world. (Yes, even Antarctica!)

Following are detailed instructions on how to install MySQL over cygwin/Windows XP.

We will install MySQL server on Windows XP directly because of performance reasons. We could have installed Apache2 on Windows XP as well but Apache2 needs to be tightly integrated with PHP and other components, Apache was built on cygwin. Also performance loss was minimized by special build process, as discussed in Web Server @ Home – Installing Apache2.

But MySQL client needs to be tightly integrated with PHP/Apache so client needs to be built on Cygwin. For details on Cygwin installation, please read Web Server @ Home – Installing cygwin.

MySQL Server Installation on Windows XP

  • Run installer and go through installation process.
  • After Installation finishes, MySQL Configuration Wizard will pop up.
  • Configuration wizard can be invoked from installation directory or from Start -> Program Files -> MySQL
  • Configure MySQL server per your requirements, keeping following in mind
  • Allow connect through TCP Password.
  • Select Appropriate username & password
  •  Verify MySQL installation
  • Run "MySQL command line client" from MySQL installation directory or from start menu
  • Enter Password, "mysql" prompt will come up
  • Run status and check output to see if everything is okay

MySQL Server Installation on Windows XP

  • Download MySQL source tarball in your cygwin home.
  • Cygwin Home directory is located at <cygwin-installation>/home/<username>.
  • Source Tarball is located towards end on download page (http://dev.mysql.com/downloads/)
  • Open cygwin Bash shell, and you should see mysql-<x.x.x>.tar.gz in the directory. (execute 'ls' to see contents.
  • Unzip and Untar source tarball

tar xvfz mysql-<x.x.x>.tar.gz

  • Change Directory –  cd mysql-<x.x.x>
  • Run Followin Command

configure –prefix=/usr/local/mysql –without-server –with-mysqld-user=<username>

  • Username above is username configured in your MySQL server (See Windows part of installation)
  • make; make install
  • Check if 'make' and 'make install' finish without any error.
  • cp /usr/local/mysql/share/mysql/my-<xxx>.cnf /etc/my.cnf (Any file will do because without server, rest of the options doesn't make any sense. Or lets say copy my-large.cnf)
  • edit /etc/my.cnf
  • Find line containing [client]
  • Add/modify following lines just after,
  •       password = <password>
  •       user     = <user>
  •       protocol = tcp
  •       host     = localhost
  • User Name/Password are the ones which are configured to be used with MySQL server (installed on Windows XP directly). Modify rest of the file according to your needs.
  • type /usr/local/mysql/bin/mysql.exe on bash shell prompt and hit enter.
  • It should run without error, everything should be fine and mysql prompt should come up directly.

Hmmm…. few more steps to go but we are about to finish. Remember basic web server is already installed in previous article and you can start playing with basic stuff like html, java scripts etc. MySQL and PHP are just for more features (Though are very common). Hang in there!!

Next: Installing PHP.. Stay tuned…

Leave a Reply

Your email address will not be published. Required fields are marked *