|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的好朋友们!1、MySQL是一个开放源码的小型联系关系式数据库办理体系,开辟者为瑞典MySQLAB公司。MySQL被普遍地使用在Internet上的中小型网站中。因为其体积小、速率快、整体具有本钱低,特别是开放源码这一特性,很多中小型网站为了下降网站整体具有本钱而选择了MySQL作为网站数据库。假如用Linux作为操纵体系,Apache作为web办事器,MySQL作为数据库,PHP/Perl/Python作为办事器端剧本注释器就能够组分解不乱、收费、功效壮大的网站体系,也就是所谓的LAMP组合,这篇文复杂先容一下MySQL的装置设置。
2、MySQL装置流程以下图:
3、MySQL编译装置详细完成:
筹办情况,因为SQL的数据量增加很快,MySQL数据库最好放在LVM上以便很好的举行扩大。
创立逻辑卷用来寄存数据库
[root@localhost~]#ls-l/dev/sdb1
brw-rw----1rootdisk8,17Mar1200:19/dev/sdb1
[root@localhost~]#pvcreate/dev/sdb1
Physicalvolume"/dev/sdb1"successfullycreated
[root@localhost~]#vgcreatel23f/dev/sdb1
Volumegroup"l23f"successfullycreated
[root@localhost~]#lvcreate-L2G-nl23l23f
Logicalvolume"l23"created
[root@localhost~]#lvs
LVVGAttrLSizePoolOriginData%MoveLogCpy%SyncConvert
l23l23f-wi-a-----2.00g
rootvg0-wi-ao----20.00g
swapvg0-wi-ao----2.00g
usrvg0-wi-ao----10.00g
varvg0-wi-ao----20.00g
对逻辑卷举行格局化
[root@localhost~]#mke2fs-text4/dev/l23f/l23
筹办数据库寄存目次并挂载逻辑卷
[root@localhost~]#mkdir-pv/data/mysqldata
mkdir:createddirectory`/data
mkdir:createddirectory`/data/mysqldata
[root@localhost~]#mount/dev/l23f/l23/data/mysqldata
下载文件并解压
[root@localhost~]#lftp172.16.0.1
lftp172.16.0.1:~>cdpub/Sources/6.x86_64/mysql/
lftp172.16.0.1:/pub/Sources/6.x86_64/mysql>ls
-rw-r--r--100186839926Aug222013mysql-5.5.33-linux2.6-x86_64.tar.gz
-rw-r--r--100307062424Aug222013mysql-5.6.13-linux-glibc2.5-x86_64.tar.gz
-rw-r--r--100307176769Oct0705:26mysql-5.6.14-linux-glibc2.5-x86_64.tar.gz
lftp172.16.0.1:/pub/Sources/6.x86_64/mysql>getmysql-5.5.33-linux2.6-x86_64.tar.gz
186839926bytestransferredin25seconds(7.07M/s)
lftp172.16.0.1:/pub/Sources/6.x86_64/mysql>bye
[root@localhost~]#ls-lmysql-5.5.33-linux2.6-x86_64.tar.gz
-rw-r--r--1rootroot186839926Aug222013mysql-5.5.33-linux2.6-x86_64.tar.gz
[root@localhost~]#tarxfmysql-5.5.33-linux2.6-x86_64.tar.gz-C/usr/local/
[root@localhost~]#ln-sv/usr/local/mysql-5.5.33-linux2.6-x86_64//usr/local/mysql
`/usr/local/mysql->`/usr/local/mysql-5.5.33-linux2.6-x86_64/
[root@localhost~]#cd/usr/local/
[root@localhostlocal]#ls
binetcgamesincludeliblib64libexecmysqlmysql-5.5.33-linux2.6-x86_64sbinsharesrc
创立mysql用户和组,因为root权限太年夜以是十分不宁静,必要创建mysql用户
[root@localhostlocal]#groupaddmysql
[root@localhostlocal]#useradd-gmysqlmysql
[root@localhostlocal]#idmysql
uid=500(mysql)gid=500(mysql)groups=500(mysql)
[root@localhostlocal]#
设置权限
[root@localhostmysql]#chown-Rmysql:mysql./*
[root@localhostmysql]#chown-R:mysql/data/mysqldata/
[root@localhostmysql]#ll
total200
drwxr-xr-x2mysqlmysql4096Mar1200:42bin
-rw-r--r--1mysqlmysql17987Jul152013COPYING
drwxr-xr-x3mysqlmysql4096Mar1200:42data
drwxr-xr-x2mysqlmysql4096Mar1200:42docs
drwxr-xr-x3mysqlmysql4096Mar1200:42include
-rw-r--r--1mysqlmysql134493Jul152013INSTALL-BINARY
drwxr-xr-x3mysqlmysql4096Mar1200:42lib
drwxr-xr-x4mysqlmysql4096Mar1200:42man
drwxr-xr-x10mysqlmysql4096Mar1200:42mysql-test
-rw-r--r--1mysqlmysql2496Jul152013README
drwxr-xr-x2mysqlmysql4096Mar1200:42scripts
drwxr-xr-x27mysqlmysql4096Mar1200:42share
drwxr-xr-x4mysqlmysql4096Mar1200:42sql-bench
drwxr-xr-x3mysqlmysql4096Mar1200:42support-files
[root@localhostmysql]#ll/data/mysqldata/
total16
drwx------2rootmysql16384Mar1200:34lost+found
装置、设置
[root@localhostmysql]#scripts/mysql_install_db--datadir=/data/mysqldata/--user=mysql
设置办事剧本和mysql设置文件
[root@localhostmysql]#cpsupport-files/mysql.server/etc/rc.d/init.d/mysqld
[root@localhostmysql]#cpsupport-files/my-large.cnf/etc/my.cnf
[root@localhostmysql]#vim/etc/my.cnf
增加办事,启动mysql
[root@localhostmysql]#chkconfig--addmysqld
[root@localhostmysql]#chkconfig--listmysqld
mysqld0:off1:off2:on3:on4:on5:on6:off
[root@localhostmysql]#servicemysqldstart
StartingMySQL[OK]
[root@localhostmysql]#
修正情况变量
[root@localhostlocal]#vim/etc/profile.d/mysql.sh
[root@localhostlocal]#./etc/profile.d/mysql.sh
[root@localhostlocal]#servicemysqldstart
StartingMySQL[OK]
[root@localhostlocal]#servicemysqldstop
ShuttingdownMySQL.[OK]
[root@localhostlocal]#servicemysqldstart
StartingMySQL..[OK]
[root@localhostlocal]#
装置完成,上岸举行测试
为了开辟时能够挪用mysql举行以下设置
1
2
3
4
5
[root@localhostmysql]#ls
bindataincludelibmysql-testscriptssql-bench
COPYINGdocsINSTALL-BINARYmanREADMEsharesupport-files
[root@localhostmysql]#ln-sv/usr/local/mysql/include//usr/include/mysql
`/usr/include/mysql->`/usr/local/mysql/include/
库文件写进设置文件
1
[root@localhostmysql]#vim/etc/ld.so.conf.d/mysql.conf
man文档写进设置文件
1
vim/etc/man.config
1
[root@localhostmysql]#manmysql
全部历程停止。。。。。。
本文出自“海天空”博客,请务必保存此出处http://il23f.blog.51cto.com/8620950/1381354
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的好朋友们! |
|