AMME MAHAMAYE
  Blog
 

 

Installation of MYSQL on Linux

Feb, 09 '10 Subject: MySQL, Viewed by: 17
 
1.)Download mysql-5.0.51a-linux-i686-glibc23.tar.gz from anywhere.
---------
2.)Next, let’s create the mysql user and group:
---------
#groupadd mysql
#useradd -g mysql mysql

3.)And continue with the actual installation:
---------
#cd /usr/local
#gunzip < /usr/local/src/mysql-5.0.51a-linux-i686-glibc23.tar.gz | tar xvf -
#ln -s mysql-5.0.51a-linux-i686-glibc23 mysql
#cd /mysql/
#scripts/mysql_install_db --user=mysql
#chown -R root .
#chown -R mysql data
#chgrp -R mysql .
#########################################################
The mysqld binary will search for configuration file under: /etc/my.cnf, /my.cnf and /my.cnf . You can start with one of the supplied configs (my-small.cnf, my-medium.cnf, my-large.cnf, my-huge.cnf or my-innodb-heavy-4G.cnf) and customize it accordingly to your needs. I chosen to put this one under /usr/local/mysql, so I can have more mysql instances running, each with its local my.cnf:
#########################################################
#cp support-files/my-medium.cnf my.cnf
#vim my.cnf
4.)Once you are happy with the config you can start mysql manually using:
#bin/mysqld_safe --user=mysql &

5.)You can stop it manually with:

/usr/local/mysql/bin/mysqladmin shutdown

6.)Start MySql >>>>>>>>>>>>>
/usr/local/mysql/bin/mysql
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~






=======================
Basics of MYSQL

Feb, 09 '10 Subject: MySQL, Viewed by: 14
 
1.)Table creation on sql
***********************

create table contact
(
id INT NOT NULL AUTO_INCREMENT
PRIMARY KEY,
first_name varchar (30),
Last_name varchar (30),
phone varchar (15)
)

#######################

desc contact

#######################

2.)Adding Values to TABLES
************************
insert into contact values
(
1,'Remya','Gopi','90*6***40'
)
#######################
3.)For updating table values
***************************
select * from contact
update contact
set phone = '04683333'
where id = 1

#######################

4.)For delete value from TABLE
*****************************
delete from contact
where id = 1

#######################

5.)For deleting a TABLE
***********************
drop table contact

#######################

6.)Adding a column on a table
***************************
alter table test add state varchar2 (2)

#######################

7.)Deleting a column on a table
*******************************
alter table noc DROP COLUMN salary

#######################

8.)Comparison
***************
select * from list
where age >= '25'
========================
select * from ardc
where id = '1' or id = '2'

select * from ardc
where id != '1' and id = '2'

#######################

9.)IN or NOT IN
**************

select * from ardc
where id not in (1,3)

select * from ardc
where id in (1,3)

select * from ardc
where name not in ('Sreenu Raghavan','Ratheesh')

select * from ardc
where name in ('Sreenu Raghavan','Ratheesh')

#######################

10.)BETWEEN or NOT BETWEEN
***********************
select * from ardc
where id between 1 and 3

select * from ardc
where id >= 1 and id <= 3


select * from ardc
where id not between 1 and 3


select * from ardc
where id < 1 or id > 3

#######################

11.)LIKE or NOT LIKE with % or _
********************
select * from ardc
where name like 'S%'

select * from ardc
where name like 'S_ee_u%'

select * from ardc
where name not like 'S_ee_u%'

#######################

12.)< or >
*******
select * from noc
where salary < prev_salary

select * from noc
where name > 'S'
select * from noc
where name > 'Na'

B > A
C > B
a > A

#######################

13.)NULL
******
1)insert into noc values
(7,'pratheek','madiwala','3000',null)

2)insert into noc (sl,name,house,salary) values
(7,'pratheek','madiwala','3000')

3)select * from noc
where prev_salary = null >>>> Wrong

select * from noc
where prev_salary != null >>>>>Wrong


select * from noc
where prev_salary is null >>>>>Correct

select * from noc
where prev_salary is not null >>>>>>Correct

#######################

14.)ORDER
******
select * from noc
order by name
=
select * from noc
order by salary,sl
=
select * from noc
order by 1 >>>Column Number
=
select sl,name from noc
order by 2 >>>>order should be as per select list

#######################

15.)ORDER_descending order
**********************
select * from noc
order by name desc
==
select * from noc
order by salary desc ,sl desc
==
select sl,name,salary from noc
order by 3 desc
===============================
select * from ardc
where (salary > '2000' or dept ='1') and year = '2008'

select * from ardc
where salary > '2000' or (dept ='1' and year = '2008')

select * from ardc
where dept ='1' and year = '2007'

3 Ratheesh 2600 1 2008
4 Robin 2600 2 2008
1 Sreenu Raghavan 6000 1 2007
2 Nithin Kumar 6000 2 2007
###########################################################
###########################################################

 
 
  Today, there have been 1 visitors (2 hits) on this page! © 2007 - 2010 webme GmbH  
 
This website was created for free with Own-Free-Website.com. Would you also like to have your own website?
Sign up for free