博客
一、安装mysql:
准备压缩包:mysql-5.5.33-linux2.6-x86_64.tar.gz
[root@www ~]# groupadd -r mysql<=========================新建一个mysql组,因为mysql的运行是要靠mysql用户的
[root@www ~]# useradd -g mysql -r -s /sbin/nologin mysql<==========新建mysql用户
[root@www ~]# id mysql<==================================确认一下是否建好了
uid=496(mysql) gid=493(mysql) groups=493(mysql)
[root@www ~]# ls
anaconda-ks.cfg install.log install.log.syslog mysql-5.5.33-linux2.6-x86_64.tar.gz
[root@www ~]# tar xf mysql-5.5.33-linux2.6-x86_64.tar.gz -C /usr/local<======将压缩包解压
[root@www ~]# cd /usr/local<===========================切换到此目录下,查看一下生成的文件
[root@www local]# ls
bin etc games include lib lib64 libexec mysql-5.5.33-linux2.6-x86_64 sbin share src
[root@www local]# ln -sv mysql-5.5.33-linux2.6-x86_64/ mysql<=======为文件建立一个链接, 以后使用时更方便
`mysql' -> `mysql-5.5.33-linux2.6-x86_64/'
[root@www local]# mkdir /data<=======================新建data目录,为下面设备挂载时使用
[root@www local]# fdisk /dev/sda<========================新建一个分区
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (7859-15665, default 7859):
Using default value 7859
Last cylinder, +cylinders or +size{K,M,G} (7859-15665, default 15665): +20G
Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 8e
Changed system type of partition 3 to 8e (Linux LVM)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@www local]# cat /proc/partitions<=======查看一下分区状况,如果新建的分区没有显示出 来,就重启一下
major minor #blocks name
8 0 125829120 sda
8 1 204800 sda1
8 2 62914560 sda2
8 3 20979891 sda3<==================这是新建的分区
253 0 20971520 dm-0
253 1 2097152 dm-1
253 2 10485760 dm-2
253 3 20971520 dm-3
[root@www local]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
[root@www local]# vgcreate myvg /dev/sda3
Volume group "myvg" successfully created
[root@www local]# lvcreate -L 10G -n mydata myvg
Logical volume "mydata" created
[root@www local]# lvs<===============查看一下新建的卷组信息
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
mydata myvg -wi-a---- 10.00g
root vg0 -wi-ao--- 20.00g
swap vg0 -wi-ao--- 2.00g
usr vg0 -wi-ao--- 10.00g
var vg0 -