Instmysqllinux
Instmysqllinux
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.
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.
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.
Installation Process
The simplest way to install MySQL on a Linux box is to use its RPMs.
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
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
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.
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).
Linux will check for the currently installed packages as shown in diagram
1.2
Scroll down till the MySQL database entry is reached ss shown in diagram
1.3 and diagram 1.4
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.
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.
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.
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
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.
/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>
Note down any install errors, should they surface. Often the error
message is descriptive enough to indicate what corrective action must be
taken.
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.
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.
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
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.
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
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.
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
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>
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 extracts and installs the MySQL-bench package. The output of the
install process is shown in diagram 1.13.
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.
To install MySQL-Max:
<System Prompt> rpm -ivh MySQL-Max-5.0.15-0.i386.rpm
This rpm holds the shared libraries such as libmysqlclient.so* that certain
languages and applications need to dynamically load and use MySQL.
This rpm holds the shared libraries for backward compatibility that certain
languages and older applications need to dynamically load and use
MySQL.
To verify the support for the various MySQL table data storage
engines:
mysql> SHOW ENGINES;
OR
mysql> SHOW TABLE TYPES;
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