Monday, April 27, 2009

MySQL Download & Installation

Here is the different versions of MySQL, one you can download: http://dev.mysql.com/downloads/.

MySQL Installing on Windows:

This is very much easy to install MySQL on any version of windows:

* Simply download the installer package
* Unzip it anywhere
* Run setup.exe

ByDefault installer setup.exe will install everything under C:\mysql. If you are using windows NT then you will have to use mysqld-nt.exe instead of mysqld.exe. If all became well, you will see some messages about startup and InnoDB. If not, you may have a permissions issue. Make sure that the directory that holds your data is accessible to whatever user the database processes run under. When you install MySQL successfully, then you can see that MySQL not appear in start menu. Hence, if you tend to start the server by double clicking the mysqld executable, you should remember to halt the process by hand by using mysqladmin, Task List, Task Manager, or other Windows-specific means.

Installing MySQL on Linux/Unix

On the Linux/Unix operating system, you can install MySQL via RPM. MySQL AB makes the RPM, which is available for download on its web site is as follows:

* MySQL: This is the MySQL database server, that is manages databases and tables, processes SQL queries and controls user access.
* MySQL-devel: This is the Libraries and header files that come in ready to hand when compiling other programs that use MySQL.
* MySQL-bench: This is the Benchmark and performance testing tools for the MySQL database server.
* MySQL-client: This is the MySQL client programs, which connect and interact with the server.
* MySQL-shared: This is the Shared libraries for the MySQL client.

Now follow the following steps to proceed the installation:

1. Using root user login to the system.
2. Switch to the directory holding the RPM.
3. By executing the following command Install the MySQL database server.

[root@host]# rpm -i MySQL-5.0.9-0.i386.rpm

The Above command installing MySQL server, creating a user of MySQL, creating necessary configuration and starting MySQL server automatically. Which you can find all the MySQL related binaries in /usr/bin and /usr/sbin. All the tables and databases will be created in /var/lib/mysql directory.

4. This step is optional but it is used to install the remaining RPM in the same manner.
[root@host]# rpm -i MySQL-client-5.0.9-0.i386.rpm

[root@host]# rpm -i MySQL-devel-5.0.9-0.i386.rpm

[root@host]# rpm -i MySQL-shared-5.0.9-0.i386.rpm

[root@host]# rpm -i MySQL-bench-5.0.9-0.i386.rpm

Verifying Installation:

After MySQL has been installed, the server has been started and the base tables have been initialized successfully, you can verify whether all is working or not by some simple tests.

To check out server version, use mysqladmin binary. This would be available in /usr/bin on linux and in C:\mysql\bin on windows.
[root@host]# mysqladmin --version

It can show the following output on Linux.
mysqladmin Ver 8.23 Distrib 5.0.9-0, for redhat-linux-gnu on i386

If you do not find such message then there is some problem in your installation and you would need some help to fix it.

By using MySQL client, you can connect to your MySQL server using following mysql command.
[root@host]# mysql

Now you are connected to the MySQL server and you can execute all the SQL command at mysql> prompt as follows.
mysql> SHOW DATABASES;
+---------------+
| Database |
+---------------+
| mysql |
| test |
+---------------+
2 rows in set (0.13 sec)

After-installation Steps:

You need to set a root password as follows:
[root@host]# mysqladmin -u root password "new_password";

Now to make a connection to your MySQL server, use the following command:
[root@host]# mysql -u root -p

Enter password:*******

Unix users, put your MySQL directory in your PATH, For bash shell, it would be something as:
export PATH=$PATH:/usr/bin:/usr/sbin

If you want to run MySQL server at boot time then make certain you have following entry in /etc/rc.local file
/etc/init.d/mysqld start

No comments:

Post a Comment