Installing MySQL Under Linux

I l @ ve RuBoard

Installing under Linux is as simple as installing under Windows. The only difference is that you use the Linux RPM package manager instead of an installation binary.

Downloading the Binary Distribution

Point your browser to:

http://www.mysql.com/downloads/mysql-3.23.html.

If you are running a Redhat Linux release or another release that supports the RPM file format, click the each of the five Linux Red Hat RPM download links. Save them to /tmp.

If you are not running a RPM-compatible version of Linux, download the tar.gz file for your hardware architecture to /tmp.

Installing the Linux MySQL Distribution

If you downloaded the RPM version of the distribution, cd to /tmp and, as root, do an rpm --install on each of the files to install them ”for example:

 rpm --install MySQL-client-3.23.45-1.i386.rpm 

There is no need to make any changes to the path because MySQL is installed into /usr/bin.

The mysql-server RPM installs an entry in /etc/init.d called mysqld to make MySQL start upon booting. Copy this entry into the appropriate rc.d directory.

Start MySQL by issuing this command (as root):

 /etc/init.d/mysqld start 

Installing the Linux MySQL Distribution (tar.gz Version)

If you downloaded the tar.gz version, , follow the following procedure:

 shell> groupadd mysql shell> useradd -g mysql mysql shell> cd /usr/local shell> gunzip < /tmp/mysql-3.23.47-pc-linux-gnu-i686.tar.gz  tar xvf - shell> ln -s mysql-3.23.47-pc-linux-gnu-i686 mysql shell> cd mysql shell> scripts/mysql_install_db shell> chown -R root  /usr/local/mysql shell> chown -R mysql /usr/local/mysql/data shell> chgrp -R mysql /usr/local/mysql shell> chown -R root /usr/local/mysql/bin shell> bin/safe_mysqld --user=mysql & 

Depending on the version of MySQL you downloaded, the string mysql-3.23.47-pc-linux-gnu-i686 may be slightly different. Note that if you want MySQL to start automatically, you'll need to create an init.d entry to run the bin/sage_mysqld binary.

Creating a Test Database

Open a command prompt window and type the following (user commands are in bold):

 $  mysqladmin create TestDB  $  mysql TestDB  Welcome to the MySQL monitor.  Commands end with ; or \g. Your MySQL connection id is 5 to server version: 3.23.45-nt Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>  create table TestTable (  ->  String1  CHAR(40),  ->  String2  CHAR(40));  Query OK, 0 rows affected (0.04 sec) mysql>  insert into TestTable values ('Foo', 'Bar');  Query OK, 1 row affected (0.00 sec) mysql>  select * from TestTable;  +---------+---------+  String1  String2  +---------+---------+  Foo      Bar      +---------+---------+ 1 row in set (0.00 sec) mysql>  quit  Bye $ 
I l @ ve RuBoard


MySQL and JSP Web Applications. Data-Driven Programming Using Tomcat and MySQL
MySQL and JSP Web Applications: Data-Driven Programming Using Tomcat and MySQL
ISBN: 0672323095
EAN: 2147483647
Year: 2002
Pages: 203
Authors: James Turner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net