Thursday, December 31, 2009

MYSQL IN REDHAT LINUX

MYSQL
Features:

1. DBMS Engine

2. Compabtible with various front-ends:

•Perl

•PHP

•ODBC

•GUI Management

Tasks:
1. Install MySQL Client & Server
•yum -y install mysql

/etc/my.cnf - primary config file

/usr/bin/mysql - primary client used to interact with the server

/usr/bin/mysqladmin - primary admin utility to return useful info, and perform admin tasks from the shell

• yum -y install mysql-server
/usr/libexec/mysqld - DBMS engine

2. Start MySQL server and modify perms for 'root'
•service mysqld start

•chkconfig --level 35 mysqld on

•mysqladmin -u root password abc123

3. Install 'mysql' client on a remote system and test connectivity

•yum -y install mysql

•mysql -u root -p

Note:

•mysql command-line options ALWAYS override global (/etc/my.cnf), and/or local (~/.my.cnf) configuration directives
•MySQL Users consist of the following:
•username i.e. 'root'
•host i.e. 'localhost'
•A sample username is: 'root@localhost'


4. Secure 'anonymous' account
•DELETE FROM mysql.user WHERE user = '';
•flush privileges;

5. Create Database 'addressbook'
create database AddressBook;
use AddressBook;
create table contacts (`first_name` char(20), `last_name` char(20),
`bus_phone1` char(20), `email` char(30), PRIMARY KEY (`email`));

6. Insert Data into 'contacts' table using INSERT
INSERT INTO contacts (first_name,last_name,bus_phone1,email) VALUES ('Kay','Mohammed','888.573.4943','kay@LinuxCBT.com');

7. Delete record from 'contacts' table
DELETE FROM contacts WHERE email = 'kay1@LinuxCBT.com';

8. Update a record in the 'contacts' table
UPDATE contacts SET email='kay2@LinuxCBT.com' WHERE first_name='Kay';

No comments:

Post a Comment