Monday, December 3, 2007

How to Install a MySQL Database

Just search the MySQL documentation and it will clearly tell you on how to install MySQL. Just for clarification, when you install MySQL. There's the installation for the server part and there's the installation for the client part.

When your boss or peers asked you to install MySQL, they are referring to the server part. The server is what you use to create your database and store your data. The client is what you use to 'query' your database server.

For simplicity sake, use MySQL RPMs. This is used in a Linux system. I assume that if you are using Windows that you should be able to guess what you need to do. There's a reason why you should use RPMs and the reason is that it is simple, efficient and easy to manage.

As a newbie, do not be tempted to do binary installation eventhough it looks easy and believe me it is easy too. But RPMs are way easier... here's how to install a MySQL database in a Linux system.

1. Download the appropriate MySQL RPM for your Linux system.

1.1 32-bit or 64 machine??? Oh, you need the assistance of your system administrator for this... specifically ask them if you have a 32-bit or 64-bit. For 32-bit machines, you need the RPM with 386 appended to it and the 64-bit has the 686 appended to it.

1.2 What kind of operating system? Again, ask your system administrator. It is easier to ask than to figure it on your own. So, if they tell you they are using a Fedora Core 6 (note on the version of the operating system, it is important), then just look for the corresponding RPM in the MySQL website.

2. Install the MySQL RPM.

Ahem, ahem... use this command....

rpm -ivh .rpm

How hard is that? Oh, in case you made a mistake. There are two things that will most likely happen, you will get an error saying that you downloaded the wrong RPM (you can blame your system administrator or you can blame your boss for giving you a small monitor -- can't see that right rpm in a 19" monitor) or you installed the wrong RPM.

If you installed the wrong RPM, use this command to erase it.

rpm -qa | grep -i mysql ((a) this will tell you what MySQL version was installed.)

rpm -e (result from the above) (This will remove the RPM.)

So, that's it. Your next step as outlined in the MySQL documentation is to start the server, issue some grant SQL, etc...

No comments: