Monday, August 9, 2010

mySQL Tutorial Step 3 Installation and Setup

I am choosing to do a tutorial using mySQL since it is an open source database. It is also widely used for certain projects. You first should download mySQL. I am using Windows XP, so these are the instructions I will be giving you.

See my prior posts for installing mySQL.

Now that mySQL is installed, you will need to start the service. Find your myComputer icon on your desktop or your start menu. You should select your right mouse button on it and select the manage in the list of options.

Select Services->applications and then select services. This will give you a list of all your services. If you installed mySQL as a service, then you should see a mySQL icon in the list of services. Select on it and select start service. After you have started the mySQL service, you can close the window.

Now you need to log into mySQL. Open up your Dos Prompt window. You can do this by selecting start->programs->accessories->dos prompt.

Once your DOS window is opened, you will need to traverse to the directory where your mySQL is located. You can change directories by typing: cd Name of the directory and you can move back up the directory by typing: cd ..

If you installed mySQL in your Program Files directory, you can type this from your root directory (You might need to adjust it to where your mySQL is installed) : cd \Program Files\MySQL\MySQL\MySQL Server 5.1\bin.

When you are in the correct database, you can test your installation by typing:
mysqladmin -u root -p version

Remember to enter the password that you set when you installed mysql.

Now, it is time to login to mysql. You should type the following command.

mysql -u root -p

-u specifies the root password and -p specifies to be prompted for a password.

Your dos prompt will now change from C:\> to mysql: and that means you have successfully logged in.

Now you should create a database. We are going to build a relational database that we will use later.

First create a database called: catalog. You can do this by typing Create DATABASE catalog;


Don't forget to include a semicolin after the command in mySQL.
If it says Query OK, 1 row affected then you were successful.

To exit mysql and return back to the Dos prompt, you can type exit.

In my next post I will continue to explain how you set up users and create tables in mySQL.

Go To Step 4

0 comments: