[root@owenz ~]# pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created
[root@owenz ~]# pvcreate /dev/sdc
Physical volume "/dev/sdc" successfully created
[root@owenz ~]# pvcreate /dev/sdd
Physical volume "/dev/sdd" successfully created
[root@owenz ~]# pvdisplay
"/dev/sdb" is a new physical volume of "4.00 GiB"
---NEW Physical volume ---
PVName /dev/sdb
VGName
PVSize 4.00 GiB
Allocatable NO
PESize 0
Total PE 0
Free PE 0
Allocated PE 0
PVUUID QR5oIr-Jb0A-6Ro8-b2qX-8OHv-w5Wl-DB00Rf
"/dev/sdc" is a new physical volume of "4.00 GiB"
---NEW Physical volume ---
PVName /dev/sdc
VGName
PVSize 4.00 GiB
Allocatable NO
PESize 0
Total PE 0
Free PE 0
Allocated PE 0
PVUUID FlKXlf-os3m-2R3E-tBdW-WHGe-FZ0v-XaBCWR
"/dev/sdd" is a new physical volume of "4.00 GiB"
---NEW Physical volume ---
PVName /dev/sdd
VGName
PVSize 4.00 GiB
Allocatable NO
PESize 0
Total PE 0
Free PE 0
Allocated PE 0
PVUUID MkdblI-jRqX-gvve-kASm-mWnf-LlaK-LdFNj1
[root@owenz ~]# vgcreate vg01 /dev/sdb/dev/sdc /dev/sdd
Volume group "vg01" successfully created
[root@owenz ~]# vgdisplay
---Volume group ---
VGName vg01
System ID
Format lvm2
Metadata Areas 3
Metadata Sequence No 1
VGAccess read/write
VGStatus resizable
MAXLV 0
CurLV 0
Open LV 0
MaxPV 0
CurPV 3
ActPV 3
VGSize 11.99 GiB
PESize 4.00 MiB
Total PE 3069
Alloc PE / Size 0 / 0
Free PE / Size 3069 / 11.99 GiB
VGUUID yOI1aN-qTlw-EdFN-ZVLM-zCuS-Tydf-bq8ixh
[root@owenz ~]# lvcreate -L 8G -n lv01 vg01
Logical volume "lv01" created
[root@owenz ~]# lvdisplay
---Logical volume ---
LVPath /dev/vg01/lv01
LVName lv01
VGName vg01
LVUUID RJSQjh-jmey-ZHBP-Al1L-90Wf-ZxfC-HSzjjs
LVWrite Access read/write
LVCreation host, time owenz, 2015-12-09 13:28:42 +0800
LVStatus available
#open 0
LVSize 8.00 GiB
Current LE 2048
Segments 3
Allocation inherit
Read ahead sectors auto
-currently set to 256
Block device 253:0
[root@owenz ~]# mkfs -t ext4 /dev/vg01/lv01
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
524288 inodes, 2097152 blocks
104857 blocks (5.00%) reserved for thesuper user
First data block=0
Maximum filesystem blocks=2147483648
64 block groups
32768 blocks per group, 32768 fragments pergroup
8192 inodes per group
Superblock backups stored on blocks:
32768,98304, 163840, 229376, 294912, 819200, 884736, 1605632
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystemaccounting information: done
This filesystem will be automaticallychecked every 33 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@owenz /]# mkdir mysql5.5
[root@owenz /]# mount /dev/vg01/lv01/mysql5.5/
[root@owenz /]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Wed Dec 9 11:05:29 2015
#
# Accessible filesystems, by reference, aremaintained under '/dev/disk'
# See man pages fstab(5), findfs(8),mount(8) and/or blkid(8) for more info
#
UUID=7a518bf7-8f13-497a-bf07-bf94e70807de/ ext4 defaults 1 1
UUID=36249278-cb8b-4cdf-b0fd-cc3e32af7b51swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/vg01/lv01 /mysql5.5 ext4 defaults 0 0
:wq
[root@owenz /]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 3925796 1763776 1962596 48% /
tmpfs 1961524 0 1961524 0% /dev/shm
/dev/mapper/vg01-lv01
8256952 149492 7688032 2% /mysql5.5
[root@owenz /]# rpm -qa | grep mysql
mysql-libs-5.1.66-2.el6_3.x86_64
[root@owenz /]# rpm -emysql-libs-5.1.66-2.el6_3.x86_64
error: Failed dependencies:
libmysqlclient.so.16()(64bit)is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
libmysqlclient.so.16(libmysqlclient_16)(64bit)is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
mysql-libsis needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
解决办法详见Issue 1.
[root@owenz ~]# rpm -e --nodepsmysql-libs-5.1.66-2.el6_3.x86_64
[root@owenz rpm]# rpm -ivhMySQL-server-5.5.47-1.el6.x86_64.rpm
warning:MySQL-server-5.5.47-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID5072e1f5: NOKEY
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
151209 17:06:51 [Note] /usr/sbin/mysqld(mysqld 5.5.47) starting as process 2167 ...
151209 17:06:51 [Note] /usr/sbin/mysqld(mysqld 5.5.47) starting as process 2174 ...
PLEASE REMEMBER TO SET A PASSWORD FOR THEMySQL root USER !
To do so, start the server, then issue thefollowing commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h owenzpassword 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option ofremoving the test
databases and anonymous user created bydefault. This is
strongly recommended for productionservers.
See the manual for more instructions.
Please report any problems at http://bugs.mysql.com/
服务器端安装完成之后,在/usr/share/mysql目录中会生成一个mysql启动脚本mysql.server和一些示例配置文件,其中有一个配置文件my-medium.cnf,因为mysql安装完成之后就默认成为系统服务,所以这里需要将配置文件放在系统服务的相关目录下.
[root@owenz mysql]# cp/usr/share/mysql/my-medium.cnf /etc/my.cnf
[root@owenz mysql]# service mysql start
Starting MySQL.. [ OK ]
[root@owenz mysql]# service mysql stop
Shutting down MySQL. [ OK ]
[root@owenz rpm]# rpm -ivhMySQL-client-5.5.47-1.el6.x86_64.rpm
warning:MySQL-client-5.5.47-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID5072e1f5: NOKEY
Preparing... ########################################### [100%]
1:MySQL-client ########################################### [100%]
[root@owenz bin]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.47-log MySQL CommunityServer (GPL)
Copyright (c) 2000, 2015, Oracle and/or itsaffiliates. All rights reserved.
Oracle is a registered trademark of OracleCorporation and/or its
affiliates. Other names may be trademarksof their respective
owners.
Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql>
[root@owenz rpm]# rpm -ivhMySQL-server-5.5.47-1.el6.x86_64.rpm
warning:MySQL-server-5.5.47-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID5072e1f5: NOKEY
Preparing... ########################################### [100%]
file/usr/share/mysql/charsets/Index.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/armscii8.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/ascii.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/cp1250.xml from install of MySQL-server-5.5.47-1.el6.x86_64conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/cp1256.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/cp1257.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/cp850.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/cp852.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/cp866.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/dec8.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/geostd8.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/greek.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/hebrew.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/hp8.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/keybcs2.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/koi8r.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/koi8u.xml from install of MySQL-server-5.5.47-1.el6.x86_64conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/latin1.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/latin2.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/latin5.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/latin7.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/macce.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/macroman.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/charsets/swe7.xml from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/czech/errmsg.sys from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/danish/errmsg.sys from install of MySQL-server-5.5.47-1.el6.x86_64conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/dutch/errmsg.sys from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/english/errmsg.sys from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/estonian/errmsg.sys from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/french/errmsg.sys from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/german/errmsg.sys from install of MySQL-server-5.5.47-1.el6.x86_64conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/greek/errmsg.sys from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/hungarian/errmsg.sys from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/italian/errmsg.sys from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/japanese/errmsg.sys from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/korean/errmsg.sys from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/norwegian-ny/errmsg.sys from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/norwegian/errmsg.sys from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/polish/errmsg.sys from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/portuguese/errmsg.sys from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/romanian/errmsg.sys from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/russian/errmsg.sys from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/serbian/errmsg.sys from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/slovak/errmsg.sys from install of MySQL-server-5.5.47-1.el6.x86_64conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/spanish/errmsg.sys from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/swedish/errmsg.sys from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
file/usr/share/mysql/ukrainian/errmsg.sys from install ofMySQL-server-5.5.47-1.el6.x86_64 conflicts with file from packagemysql-libs-5.1.66-2.el6_3.x86_64
原因:系统中已经安装了mysql软件包,需要先卸载
[root@owenz /]# rpm -emysql-libs-5.1.66-2.el6_3.x86_64
error: Failed dependencies:
libmysqlclient.so.16()(64bit)is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
libmysqlclient.so.16(libmysqlclient_16)(64bit)is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
mysql-libsis needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
原因:有依赖包,所以采用下面方式卸载(以上均是在虚拟机上没有联网的情况,如果连接到网络可以采用yum)
[root@owenz ~]# rpm -e --nodepsmysql-libs-5.1.66-2.el6_3.x86_64