安裝linux版qq,安裝二進制包編譯器,安裝mysql-5.6.11,刪除已安裝或安裝失敗的mysql-5.6.11,簡單mysql練習題

上午
[root@localhost ~]# ./test3.sh dev1^C
[root@localhost ~]# groupadd dev1
[root@localhost ~]# vim /etc/group
[root@localhost ~]# vim /etc/passwd
[root@localhost ~]# vim /etc/group
[root@localhost ~]# ./test3.sh dev1->tom,jerry,mike,lee^C
[root@localhost ~]# useradd -g dev1 user^[[4~
useradd: invalid user name 'user[4~'
[root@localhost ~]# useradd -g dev1 user01
[root@localhost ~]# vim /etc/passwd
[root@localhost ~]# cut -d: -f1,4 /etc/passwd
root:0
bin:1
daemon:2
adm:4
lp:7
sync:0
shutdown:0
halt:0
mail:12
uucp:14
operator:0
games:100
gopher:30
ftp:50
nobody:99
dbus:81
avahi-autoipd:170
vcsa:69
rtkit:497
ntp:38
saslauth:76
postfix:89
avahi:70
haldaemon:68
pulse:496
gdm:42
abrt:173
sshd:74
tcpdump:72
tom:500
mysql:27
apache:48
cy:502
user01:503
[root@localhost ~]# cut -d: -f1,4 /etc/passwd | grep "503"
user01:503
[root@localhost ~]# grep "dev1" /etc/group
dev1:x:503:
[root@localhost ~]# grep "dev1" /etc/group | cut -d:-f3
cut: the delimiter must be a single character
Try `cut --help' for more information.
[root@localhost ~]# grep "dev1" /etc/group | cut -d: -f3
503
[root@localhost ~]# cut -d: -f1,4 /etc/passwd | grep "503"
user01:503
[root@localhost ~]# useradd -g dev1 user02
[root@localhost ~]# cut -d: -f1,4 /etc/passwd | grep "503"
user01:503
user02:503
[root@localhost ~]# cut -d: -f1,4 /etc/passwd | grep "503"|cut -d: -f1
user01
user02
[root@localhost ~]#
[root@localhost ~]# vim /etc/group
[root@localhost ~]# useradd user03
[root@localhost ~]# userdel -r user03
[root@localhost ~]# useradd user03 -G dev1
[root@localhost ~]# useradd user04
[root@localhost ~]# gpasswd -a user04 dev1
Adding user user04 to group dev1
[root@localhost ~]# vim /etc/group
[root@localhost ~]# grep "dev1" /etc/group
dev1:x:503:user03,user04
[root@localhost ~]# grep "dev1" /etc/group |cut -d: -f4
user03,user04
[root@localhost ~]# cut -d: -f1,4 /etc/passwd | grep "503"|cut -d: -f1
user01
user02
[root@localhost ~]# cut -d: -f1,4 /etc/passwd | grep "503"|cut -d: -f1
user01
user02
[root@localhost ~]# a=`cut -d: -f1,4 /etc/passwd | grep "503"|cut -d: -f1`
[root@localhost ~]# echo $a
user01 user02
[root@localhost ~]# grep "dev1" /etc/group |cut -d: -f4
user03,user04
[root@localhost ~]# b=`grep "dev1" /etc/group |cut -d: -f4`
[root@localhost ~]# echo $b
user03,user04
[root@localhost ~]# c=$a","$b
[root@localhost ~]# echo $c
user01 user02,user03,user04
[root@localhost ~]# echo $a |tr " " ","
user01,user02
[root@localhost ~]# c=$a","$b
[root@localhost ~]# echo $c
user01 user02,user03,user04
[root@localhost ~]#

[root@localhost ~]# mkdir abc/def -p
[root@localhost ~]# ls -ld abc
drwxr-xr-x 3 root root 4096 Jul 17 09:02 abc
[root@localhost ~]# ls -l  abc
total 4
drwxr-xr-x 2 root root 4096 Jul 17 09:02 def
[root@localhost ~]# chown tom abc
[root@localhost ~]# ls -ld abc
drwxr-xr-x 3 tom root 4096 Jul 17 09:02 abc
[root@localhost ~]# ls -l  abc
total 4
drwxr-xr-x 2 root root 4096 Jul 17 09:02 def
[root@localhost ~]# chgrp -R dev1  abc
[root@localhost ~]# ls -ld abc
drwxr-xr-x 3 tom dev1 4096 Jul 17 09:02 abc
[root@localhost ~]# ls -l  abc
total 4
drwxr-xr-x 2 root dev1 4096 Jul 17 09:02 def

cd /tmp
ll test.c
su -tom
cd /tmp
ll test.c
chmod 764 test.c
ll test.c
logout
ll test.c
chown root test.c
ll test.c
su - tom
cd /tmp/
ll test.c
chown tom test.c
ll test.c
su - tom
cd /tmp/
ll test.c
chgrp dev1 test.c               vim /etc/group
                                 vim /etc/passwd
                                   usermod -g 600 tom
                                    vim /etc/passwd
logout
su -tom
cd /tmp/
ll test.c
chgrp dev1 test.c
ll test.c
chgrp dev1 test.c
ll test.c

logout
ll test.c
chown .root test.c
ll test.c
usermod -g 500 tom
su - tom
cd /tmp
ll test.c
chgrp dev1 test.c
logout

gpasswd -a tom dev1
su -tom      切換到tom用戶
cd /tmp/
ll test.c
chgrp dev1 test.c
ll test.c

安裝qq
  lftp 10.0.0.34
  983  LS
  984  ls
  985  ar -x WineQQ2012-20121130-Longene.deb
  986  ls
  987  tar xf data.tar.gz
  988  tar xf control.tar.gz
  989  ls
  990  cd opt/
  991  ls
  992  ls longene/
  993  cp longene/ /opt/ -r
  994  ls
  995  cd ../usr/
  996  ls
  997  cd bin/
  998  ls
  999  cp qq2012 /bin/
 1000  qq2012
 1001  history


下午:
chmod
chown
chgrp

umask
umask 默認是0022,不推薦修改umask值,修改後只對當前會話有效,新開一個終端時,umask恢復默認值
新建文件的權限是666-umask
新建文件夾的權限是777-umask
[root@localhost ~]# umask -p
umask 0022
[root@localhost ~]# umask -S
u=rwx,g=rx,o=rx
[root@localhost ~]# umask 0033
[root@localhost ~]# umask -S
u=rwx,g=r,o=r
[root@localhost ~]# umask -p
umask 0033
#------------------------------------------------------------------------------------
安裝mysql-server
yum install mysql-server
查看mysql服務進程:
ps aux|grep "mysql" 對應有兩個,也與/etc/my.cnf文件相對應
查看mysql服務的端口號:
netstat -ntaup | grep "mysql"

cd Packages/
ls mysql*
ls mysql-5.1.61...
ls mysql-server-5.1

cat !$ 上一條命令的最後看到的信息
mysql
1.sql分析,select,insert,update,delete
   index select * from emp where empID>10 and empID<20

2.數據遷移,ms sqlServer,mysql, ms->mysql,mysql->oracle

3.sql編程,sql語言編程 ,shell編程,c,php,java,

#-------------------------
學生選課系統,學生,課程,選課信息,院系信息
要查詢到學生信息,課程信息,院系信息,選課信息(張三選了哪些課,數據結構有哪些人選了)

學生stu(學號sno,姓名sname,所在院系deptno)
課程course(課程編號cno,課程名稱cname)
選課sc(學號sno,課程編號cno)
院系dept(院系編號deptno,院系名稱deptname)

create table dept(
    deptno int  primary key,
    deptname varchar(32)
 )engine=innodb charset=utf8;

create table stu(
      sno int primary key,
      sname varchar(16) not null,
      sage int,
      deptno int ,
      foreign key(deptno) references dept(deptno)  
)engine=innodb charset=utf8;


create table course(
     cno  int  primary key,
     cname varchar(16)  not null
)engine=innodb charset=utf8;
create table sc(
    cno  int ,
    sno  int ,
   primary key(cno,sno),
   foreign key(cno) references course(cno),
  foreign key(sno) references stu(sno)
    
)engine=innodb charset=utf8;

create table t1
(
   f1 int(4) zerofill,
   f2 varchar(32) default 'jerry'
)engine=innodb charset=utf8;

--mysql-server,rpm
rpm redhat,rpm認爲製做,rpm
rpm -ivh
yum install 定製程度不高
/usr/local/mysql /usr/local/mysql5.6
二進制的包

yum install cmake make gcc gcc-c++ -y

安裝
一行命令太長時換行用\
[root@localhost mysql-5.6.11]# cmake \
> -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/mysql56 \
> -DMYSQL_DATADIR:PATH=/database \
> -DWITH_DEBUG:BOOL=on \
> -DWITH_EXTRA_CHARSET:STRING=all \
> -DWITH_INNOBASE_STORAGE_ENGINE:BOOL=on \
> -DWITH_PARTITION_STORAGE_ENGINE:BOOL=on

make  make就會調用gcc,gcc-c++編譯器來編譯源代碼文件
make install  安裝到/usr/local/mysql56

ls /etc/my.cnf
cd /usr/local/mysql56/
mkdir etc
cd etc
cp /etc/my.cnf .
vim my.cnf
[mysqld]
basedir=/usr/local/mysql56
datadir=/database
socket=/var/run/mysqld/mysql56.sock
pid-file=/var/run/mysqld/mysql56.pid
port=3307
user=mysql
[mysqld_safe]
log-error=/var/log/mysqld/mysqld56-error.log

cat my.cnf
mkdir /database
mkdir /var/log/mysqld
ls /var/run/mysqld/
cat my.cnf

chown mysql.mysql /usr/local/mysql56/ /database/ /var/run/mysqld/ /var/log/mysqld -R
cd ..
到了mysql56下
pwd
/usr/local/mysql56
ls
cd scripts/
ls
(file mysql_install_db    看3和5是否爲on
vim mysql_install_db)

./mysql_install_db --datadir=/database/ --basedir=/usr/local/mysql56/ --user=mysql

cd ~/mysql-5.6.11/support-files/
ls mysql.server
file mysql.server
vim mysql.server
cp mysql.server /etc/rc.d/init.d/mysql5
vim /etc/rc.d/init.d/mysql56
=conf
conf=/usr/local/mysql562/etc/my.cnf
chkconfig --list mysqld
chkconfig --add mysql56
chkconfig --list mysql56
chkconfig --level 35 mysql56 on


cd /usr/local/mysql56/etc

刪除已經安裝或安裝失敗的mysql-5.6.11
[root@localhost init.d]# cd /usr/local/
[root@localhost local]# ls
bin  games    lib      mysql563                      mysql58  share  Yozosoft
etc  include  libexec  mysql56-DMYSQL_DATADIR:PATH=  sbin     src
[root@localhost local]# rm -rf mysql563
[root@localhost local]# rm -rf mysql56-DMYSQL_DATADIR\:PATH\=/


php

相關文章
相關標籤/搜索