安装linux版qq,安装二进制包编译器,安装mysql-5.6.11,删除已安装或安装失败的mysql-5.6.11,简单mysql练习题

时间:2022-03-19 11:57:56

上午
[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\=/