0% found this document useful (0 votes)
86 views

Instmysqllinux

The document discusses installing MySQL 5.0.15 on Linux. It describes uninstalling older MySQL versions, downloading the MySQL 5.0.15 RPMs, and going through the installation process.

Uploaded by

api-3730515
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views

Instmysqllinux

The document discusses installing MySQL 5.0.15 on Linux. It describes uninstalling older MySQL versions, downloading the MySQL 5.0.15 RPMs, and going through the installation process.

Uploaded by

api-3730515
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Installing MySQL 5.0.

15 Database On Linux
MySQL is a really popular, Relational DataBase Management System
(RDBMS), from the open source domain. It is used extensively by
communities that wish to establish a dynamic web presence.

MySQL was created by a company owned by two Swedes, David Axmark


and Allan Larsson and a Finn named Michael Monty Widenius who worked
together since the 1980's in Sweden. They pride themselves in being a
truly, second generation, open source company. With MySQL they have a
dual licensing policy that helps support open source values while being
a profitable, sustainable business.

All software that wishes to participate in the Open Source game plan must
abide by the GNU Public License (GPL). The GPL dictates that all software,
(in this case MySQL) can be used at no cost and that its source code is
also made available under GPL.

This also means that if MySQL code is required for the application to
function or if MySQL is distributed along with the software application, the
application's source code must be also made available at no cost.

Some of the world's largest organizations Sabre Holdings, Cox


Communications, The Associated Press, NASA and Suzuki have obtained
significant cost savings by using MySQL to power their Web sites and
business critical enterprise applications and packaged software.

Because many commercial organizations use this product, MySQL chose to


privately license the software. This permits the commercial application
using MySQL as their Db engine of choice, to keep their application source
code private. Private licenses can be acquired on a per database server
basis, starting at $200 for a single unit (or less, if there are a huge
number of users).

MySQL works in perfect harmony with PHP, Perl, Python and Pascal and a
host of other languages. If any ANSI SQL / DBMS technical skills exist in
the organization of adoption, these can be leveraged on when using
MySQL, to ensure that MySQL does whatever is required of it.

IVAN BAYROSS (DOT) COM


Page 2

MySQL's outstanding benefits are:


‰ Sharply reduced database licensing costs
‰ A cut in system downtime
‰ Lower hardware expenditure
‰ A Reduction in administration, engineering and support costs
‰ Effortlessly handles large databases i.e. more than 50,000,000 records
‰ With MySQL there are no memory leakages

MySQL helps reduce / eliminate major problems associated with


downtime, maintenance, administration and support. It offers superior
speed, reliability and ease of use. This has made MySQL become the
preferred choice of corporate IT Managers.

Installation Process

The simplest way to install MySQL on a Linux box is to use its RPMs.

When creating this material, MySQL version 5.0.15 was the


production release on the mysql.com web site.

Determine The Current MySQL Version

First establish what version of MySQL is loaded on the Linux box.

Open a terminal window and at the system prompt key the following. The
output displayed in its response, will indicate the version of the MySQL Db
server currently installed:
<System Prompt> mysqladmin version

When the default MySQL package (bundled along the installation


CD-ROM) for Fedora Core 3 is installed, MySQL version 3.23.58-
13 is setup on the Linux machine.

INSTALLING MySQL 5.0.15 DATABASE ON LINUX


Page 3

The command issued will display the following on the VDU screen:
mysqladmin Ver 8.40 Distrib 3.23.58, for pc-linux on i686
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX
DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is
free software,
and you are welcome to modify and redistribute it under the
GPL license

Server version 3.23.58-13


Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 36 min 28 sec

Threads: 1 Questions: 7 Slow queries: 0 Opens: 6 Flush


tables: 1
Open tables: 0 Queries per second avg: 0.003

And the system prompt reappears.

This information can be obtained by executing the MySQL's SELECT


VERSION() command:
mysql> SELECT VERSION();

This command must be issued only at the MySQL prompt as shown


above.

Output:
+-------------+
| VERSION() |
+-------------+
| 3.23.58-13 |
+-------------+
1 row in set (0.00 sec)

Once the version of the MySQL installed is known and if this is an older
version than the RPMs downloaded, its time to upgrade (or reinstall) the
MySQL database engine.

IVAN BAYROSS (DOT) COM


Page 4

Usually all Linux flavors come bundled with some older version of the
MySQL Database rpms. Prior installing a newer version of MySQL the older
version needs to be uninstalled, to prevent any clashes between newer
versions of the MySQL RPMs being installed and the older MySQL files
already installed (when the O/s of choice was installed).

This can be done via Add/Remove Applications or Via Linux Command


Line.

Using The Add/Remove Applications Tool

The simplest way to uninstall an old version of MySQL would be to go to


the Add/Remove Application Utility in currently installed flavor of
Linux. Using this utility, completely uninstall the old version of MySQL
server and its client tools if any.

To start the Add/Remove Applications from Linux click Start Menu Æ


System Settings Æ Add or Remove Applications as shown in diagram
1.1

Diagram 1.1: Opening Add or Remove Applications

Linux will check for the currently installed packages as shown in diagram
1.2

INSTALLING MySQL 5.0.15 DATABASE ON LINUX


Page 5

Diagram 1.2: The System Check Dialog Box

The Add or Remove Packages window pops up.

Scroll down till the MySQL database entry is reached ss shown in diagram
1.3 and diagram 1.4

Diagram 1.3: Add or Remove Packages Dialog Box

Uncheck the checkbox against MySQL Database as shown in the diagram


1.5. Then click

IVAN BAYROSS (DOT) COM


Page 6

Diagram 1.4: Location of MySQL Database. Diagram 1.5: Uncheck the MySQL Database
checkbox.

This will now uninstall the old version of MySQL from the Linux box. Once
done click Quit.

After using the Add/Remove Application Utility to un-install the


older version of MySQL, re-check the Linux machine for the
presence of the older version.

If for any reason, the Add/Remove Application Utility is unable to


un-install the older version of MySQL, the only alternative is to use
a Command line based, manual system to uninstall the old version
of MySQL.

Using Linux Command Line To Uninstall MySQL

Open a Terminal Window and at the command prompt enter the following
command:
<System Prompt> rpm –qa mysql

This uses the rpm command itself to query the kernel and find out what
version of the MySQL RPMs are loaded on the computer. This should print
out a list of the MySQL RPMs installed on the VDU screen as shown in
diagram 11.6.6.

On Fedora Core 3, the above command produces an output as shown in


1.6.

INSTALLING MySQL 5.0.15 DATABASE ON LINUX


Page 7

Diagram 1.6: Querying For RPMs

If nothing is visible on the VDU, then no MySQL RPMs have been


installed on the Linux computer. Hence a fresh installation can
be carried out immediately.

If MySQL RPMs have been installed, Uninstall them manually as shown:


<System Prompt> rpm -e mysql

The rpm command is used with the -e switch to uninstall (i.e. erase)
mysql. Since MySQL has a number of sub-modules, which in turn have
dependencies, the un-installation process fails and the following messages
may be displayed on the VDU as shown in diagram 1.7.

Diagram 1.7: Erasing Pre-Installed MySQL

IVAN BAYROSS (DOT) COM


Page 8

This indicates that all the dependencies of MySQL have to be uninstalled


first. In addition to this, the error message lists other packages bound to
MySQL, which are installed on the Linux machine.

Note down the dependencies of MySQL from this message (i.e. packages
that begin with mysql-) have to be uninstalled. Then one at a time, use
the following command to remove each package:
<System Prompt> rpm -e <name of the RPM to be removed>

In the case of MySQL 3.23.58 installed under Fedora Core 3, uninstall the
packages bound to MySQL as follows: (As shown in diagram 1.7)
<System Prompt> rpm -e mysql-devel
<System Prompt> rpm -e mysql-bench
<System Prompt> rpm -e mysql-server
<System Prompt> rpm -e --nodeps mysql

In the case of MySQL 4.0.17 (or above) installed under Fedora Core 3
uninstall the MySQL packages as follows: (As shown in diagram 1.8)
<System Prompt> rpm -e MySQL-embedded
<System Prompt> rpm -e MySQL-devel
<System Prompt> rpm -e MySQL-bench
<System Prompt> rpm -e MySQL-client
<System Prompt> rpm -e MySQL-shared
<System Prompt> rpm -e MySQL-Max
<System Prompt> rpm -e --nodeps MySQL-server

Diagram 1.8: Erasing Pre-Installed MySQL

Ensure that each RPM name is spelled exactly as shown on the VDU
screen. If while removing an rpm certain dependencies are encountered
that are required even after MySQL has been un-installed, then uninstall
that rpm using --nodeps switch. This will forcibly remove that RPM
without bothering about the removal of any of its dependencies.

INSTALLING MySQL 5.0.15 DATABASE ON LINUX


Page 9

One of the techniques, mentioned above, should ensure that MySQL


(and/or its dependencies) have been unloaded from the Linux box. Now,
a clean, fresh, install from the RPMs downloaded from the MySQL web site
can then take place.

Installing MySQL Using RPMs


Login as root (or su to root). Create a subdirectory under the root
directory ( / ) and copy the RPMs downloaded to this sub directory.
example: /mysqlrpms (As shown in diagram 1.9)
<System Prompt> cd /
<System Prompt> mkdir mysqlrpms
<System Prompt> cd mysqlrpms

/mysqlrpms should have the following RPMs within it: (As shown in table
1.1)
RPM Name
MySQL-bench-5.0.15-0.i386.rpm
MySQL-client-5.0.15-0.i386.rpm
MySQL-devel-5.0.15-0.i386.rpm
MySQL-embedded-5.0.15-0.i386.rpm
MySQL-Max-5.0.15-0.i386.rpm
MySQL-server-5.0.15-0.i386.rpm
MySQL-shared-5.0.15-0.i386.rpm
MySQL-shared-compat-5.0.15-
0.i386.rpm
Table 1.1

All the RPMs can be installed one after the other using rpm -ivh *.rpm at
the system prompt or one RPM can be installed at a time. If there are
installation errors, these can be noted down and take necessary action to
correct these errors. To install RPMs individually:
<System Prompt> rpm –ivh <The name of the RPM to install>

Occasionally, while installing MySQL-bench an error might popup


indicating the need for the PERL-DBI module.

This is available as the perl-DBI-1.32-5.i386.rpm file in the second


CD-ROM of Fedora Core 3. Install this RPM before installing MySQL-
bench.

IVAN BAYROSS (DOT) COM


Page 10

Diagram 1.9: Creating environment for Installation


The hierarchy of the RPM install process must be as follows, if
individual RPMs are installed:
1. MySQL-server-5.0.15-0.i386.rpm
2. MySQL-client-5.0.15-0.i386.rpm
3. MySQL-devel-5.0.15-0.i386.rpm
4. MySQL-bench-5.15-0.i386.rpm
5. MySQL-embedded-5.0.15-0.i386.rpm
6. MySQL-Max-5.0.15-0.i386.rpm
7. MySQL-shared-5.0.15-0.i386.rpm
8. MySQL-shared-compat-5.0.15-0.i386.rpm

If only the MySQL database engine and the MySQL database


interactive, character based, client are required then their RPMs
need be installed.

Note down any install errors, should they surface. Often the error
message is descriptive enough to indicate what corrective action must be
taken.

INSTALLING MySQL 5.0.15 DATABASE ON LINUX


Page 11

When installing pre-packaged binaries on Linux, (i.e. RPMs) the


standard MySQL server package must be installed and an optional
Max package should be installed.

The Max package is required if InnoDB or BDB data file types will
be used in addition to the MyISAM data file type of MySQL DBMS.
Using these files on Linux is desirable hence it is recommended that
the Max (additional) package is installed along with the standard
MySQL server package.

What To Do If An Error Cannot Be Handled Easily

Log into the MySQL web site and visit their MySQL install FAQs. Often this
provides the solution.

If that does not work, then log onto any of the MySQL forums on the
Internet and post the following details:
‰ The Operating System and its version number
‰ The full name of the MySQL RPM causing the error
‰ Details of the error message displayed
And request a solution.

The Directory Tree Created On The Hard Disk During Installation


An installation of MySQL done via RPMs generally places MySQL files in
the following sub directories during their install process: (Refer to table
1.2)
Directory Name Contents Of The Directory
/usr/bin All client programs and mysql_install_db
/usr/sbin mysqld server daemon
/var/lib/mysql Log files, databases
/usr/share/doc/packages Documentation
/usr/include Include (header) files
/usr/lib Libraries
/usr/share/mysql Error message and character set files
/usr/share/sql-bench Benchmarks
Table 1.2

IVAN BAYROSS (DOT) COM


Page 12

MySQL Database - Engine Install Process

The MySQL-server-5.0.15-0.i386.rpm holds the MySQL server. Given


below, is a description of an RPM-based installation of the MySQL
Database Engine.

Open a Linux terminal window (i.e. Console Terminal). Navigate from the
current directory to the sub directory where the MySQL .rpm files exist
(i.e. /mysqlrpms). Then execute the command shown below: (As shown in
diagram 1.10)
<System Prompt> rpm -ivh MySQL-server-5.0.15-0.i386.rpm

Diagram 1.10: Installing MySQL Server

The -i switch of rpm starts the extraction and installation of the MySQL
server. The result of this process is displayed in the VDU, as shown in
diagram 1.10. Once complete the terminal window will redisplay system
prompt.

INSTALLING MySQL 5.0.15 DATABASE ON LINUX


Page 13

The warning, MySQL-server-5.0.15-0.i386.rpm: V3 DSA signature:


NOKEY, key ID 5072e1f5 can be safely ignored. This is because the
RPM was not verified prior its install.

Instructions on how to verify the RPMs prior their install is provided


on the MySQL web site.

MySQL Database - Interactive Character Based - Client Install


The MySQL-client-5.0.15-0.i386.rpm contains the interactive, character
based, MySQL client. This tool permits connecting to a MySQL Db server
and communicating with it interactively using a character based, user
interface.

In the same Linux terminal window used previously, execute the following
command: (As shown in diagram 1.11)
<System Prompt> rpm -ivh MySQL-client-5.0.15-0.i386.rpm

Diagram 1.11: Installing MySQL Client

This command will extract and install the MySQL client. This process is
displayed in the VDU as shown in diagram 1.11. Once complete, the
terminal window once again displays the system prompt.

Once both the database engine and its interactive client have installed
successfully, the MySQL DataBase Management System (DBMS) is ready
to run on the Linux box.

IVAN BAYROSS (DOT) COM


Page 14

To verify that all is well with the installation of the MySQL Db and its
client:
‰ Open a terminal window (other than the one used for installation) and
execute the command:
<System Prompt> mysqladmin version

‰ This displays information related to the currently installed version of


MySQL as follows:
mysqladmin Ver 8.41 Distrib 5.0.15, for pc-linux-gnu on i686
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX
DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is
free software,
and you are welcome to modify and redistribute it under the
GPL license

Server version 5.0.15-standard


Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 1 min 43 sec

Threads: 1 Questions: 2 Slow queries: 0 Opens: 0 Flush


tables: 1 Open tables: 6 Queries per second avg: 0.019

‰ The terminal window redisplays the system prompt


‰ The current MySQL Server Version (i.e. 5.0.15-standard) is visible
‰ An alternate method of checking the MySQL version is to start the
MySQL client tool:
<System Prompt> mysql

‰ The mysql command invokes the MySQL client and the following is
displayed in the terminal window:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 5.0.15-
standard
Type 'help;' or '\h' for help. Type '\c' to clear the
buffer.
mysql>

INSTALLING MySQL 5.0.15 DATABASE ON LINUX


Page 15

‰ The system prompt in the terminal window changes to mysql. At the


mysql prompt execute the following command to see the version for
MySQL database:
mysql> SELECT VERSION();

‰ The output is as follows:


+-----------------+
| VERSION() |
+-----------------+
| 5.0.15-standard |
+-----------------+
1 row in set (0.17 sec)

‰ To exit back to the (Linux) system prompt do the following:


mysql> EXIT

‰ Its output is:


Bye

‰ The terminal window once again displays the system prompt


‰ Install the remaining MySQL RPMs, in the hierarchy explained earlier

The version seen above is 5.0.15-standard (i.e. Standard and not


Max). This will change to 5.0.15-Max when the MySQL-Max-
5.0.15-0.i386.rpm is installed.

MySQL Database - Devel Install


The MySQL-devel-5.0.15-0.i386.rpm holds the libraries and include files
that are required if working with other MySQL clients, (such as various
PERL modules) is desired.
To install the MySQL-devel package run the following command: (As
shown in diagram 1.12)
<System Prompt> rpm -ivh MySQL-devel-5.0.15-0.i386.rpm

IVAN BAYROSS (DOT) COM


Page 16

Diagram 1.12: Installing MySQL-devel

This extracts and installs the MySQL-devel package. This process will be
displayed in the VDU as shown in diagram 1.12.
MySQL Database - Bench Install
The MySQL-bench-5.0.15-0.i386.rpm holds the Tests and Benchmarks
package.

This rpm requires the PERL and the DBD::mysql modules to be


pre-installed for an error free install.

To install the MySQL-bench package:


<System Prompt> rpm -ivh MySQL-bench-5.0.15-0.i386.rpm

Diagram 1.13: Installing MySQL-bench

This extracts and installs the MySQL-bench package. The output of the
install process is shown in diagram 1.13.

MySQL Database - Embedded Install

The MySQL-embedded-5.0.15-0.i386.rpm holds the embedded MySQL


server library.

INSTALLING MySQL 5.0.15 DATABASE ON LINUX


Page 17

To install the MySQL-embedded package: (As shown in diagram 1.14)


<System Prompt> rpm -ivh MySQL-embedded-5.0.15-0.i386.rpm

Diagram 1.14: Installing MySQL-Embedded

This extracts and installs the MySQL-embedded package. The output of


this process is displayed on the VDU as shown in diagram 1.14.

MySQL Database - Max Install

This rpm holds the MySQL-Max server. This package brings the
capabilities of transactional control that is not available natively in the
MySQL Db engine.

The MySQL-server RPM must be installed prior installing the


MySQL-Max RPM.

To install MySQL-Max:
<System Prompt> rpm -ivh MySQL-Max-5.0.15-0.i386.rpm

Diagram 1.15: Installing MySQL-Max

This extracts and installs MySQL-Max. The processing is displayed on the


VDU as shown in diagram 1.15.

IVAN BAYROSS (DOT) COM


Page 18

MySQL Database - Shared Install

This rpm holds the shared libraries such as libmysqlclient.so* that certain
languages and applications need to dynamically load and use MySQL.

To install MySQL-shared do the following:


<System Prompt> rpm -ivh MySQL-shared-5.0.15-0.i386.rpm

Diagram 1.16: Installing MySQL-Shared

This extracts and installs the MySQL-Shared package. The installation


process will be displayed in the VDU as shown in diagram 1.16

MySQL Database - Shared-Compat Install

This rpm holds the shared libraries for backward compatibility that certain
languages and older applications need to dynamically load and use
MySQL.

To install MySQL-shared-compat do the following:


<System Prompt> rpm -ivh MySQL-shared-compat-5.0.15-0.i386.rpm

Diagram 1.17: Installing MySQL-Shared Compat

This extracts and installs the MySQL-shared-compat package. The


installation process is displayed in the VDU as shown in diagram 1.17

INSTALLING MySQL 5.0.15 DATABASE ON LINUX


Page 19

To test / verify the complete installation of the MySQL Db engine with


MySQL-Max do the following:
‰ In a terminal window (other than the one used for installation) execute
the following command:
<System Prompt> mysqladmin version

‰ The following result will be displayed within the command window:

Diagram 1.18: Verifying Current MySQL Version.


‰ Another way of testing / verifying the complete installation of the
MySQL Db engine with MySQL-Max is to start the MySQL client tool:
<System Prompt> mysql

‰ The following is displayed within the terminal window as shown in


diagram 1.19

Diagram 1.19: Starting MySQL.


‰ At the mysql prompt execute the following command to see the version
for MySQL database:
mysql> SELECT VERSION();

IVAN BAYROSS (DOT) COM


Page 20

‰ The output of the command is:

Diagram 1.20: MySQL 5.0 Version

‰ To verify the support for the various MySQL table data storage
engines:
mysql> SHOW ENGINES;

OR
mysql> SHOW TABLE TYPES;

‰ The output is as shown in diagram 1.21:

Diagram 1.21: MySQL Table Data Storage Types

INSTALLING MySQL 5.0.15 DATABASE ON LINUX


Page 21

The above diagram shows that MyISAM is the default storage engine
when MySQL is loaded on a Linux box. This can be changed (explained
later) by making appropriate changes in the my.cnf configuration file
usually available under /etc/my.cnf on a Linux box.
‰ To exit from the mysql prompt and return to the system prompt:
mysql> EXIT

‰ The output will be:


Bye
‰ The terminal window displays the system prompt. This completes the
RPM-based installation for MySQL 5.0.15-0 with MAX
Instead of installing individual RPM all the RPM's can be installed at one go
as follows:
<System Prompt> rpm –ivh *.rpm

‰ The output for the above command is as shown in diagram 1.22:

Diagram 1.22: Installing All RPMs In One Go

IVAN BAYROSS (DOT) COM

You might also like