|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
小知识:Linux在X-Window环境中就和在Windows中相似,可以说是一个Linux版的Windows。
1.下载MySQL
我下载的版本:mysql-5.5.22.tar.gz
下载地址:http://ishare.iask.sina.com.cn/f/24484435.html
2.装置之前先卸载CentOS自带的MySQL
[root@localhost~]#yumremovemysql
3.编译装置Cmake
下载cmake源码包:http://www.ckuyun.com/files/v2.8/cmake-2.8.4.tar.gz
从同享目次移至usr目次
[root@localhost~]#mv/mnt/hgfs/Share-CentOS/cmake-2.8.4.tar.gz/usr/cmake-2.8.4.tar.gz
[root@localhost~]#cd/usr
解压并装置cmake
[root@localhostusr]#tarxzvfcmake-2.8.4.tar.gz
[root@localhostusr]#cdcmake-2.8.4
[root@localhostcmake-2.8.4]#./bootstrap
---------------------------------------------
CMake2.8.4,Copyright2000-2009Kitware,Inc.
---------------------------------------------
ErrorwhenbootstrappingCMake:
CannotfindappropriateCcompileronthissystem.
PleasespecifyoneusingenvironmentvariableCC.
Seecmake_bootstrap.logforcompilersattempted.
---------------------------------------------
Logoferrors:/usr/local/src/cmake-2.8.4/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------
报错:缺乏C的编译器
处理方法:装置gcc编译器
[root@localhost~]#yuminstallgcc
持续装置Cmake
[root@localhostcmake-2.8.4]#./bootstrap
---------------------------------------------
CMake2.8.4,Copyright2000-2009Kitware,Inc.
Ccompileronthissystemis:cc
---------------------------------------------
ErrorwhenbootstrappingCMake:
CannotfindappropriateC++compileronthissystem.
PleasespecifyoneusingenvironmentvariableCXX.
Seecmake_bootstrap.logforcompilersattempted.
---------------------------------------------
Logoferrors:/usr/local/src/cmake-2.8.4/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------
报错:缺乏C++编译器
处理方法:装置gcc-c++编译器
[root@localhost~]#yuminstallgcc-c++
再次装置
[root@localhostcmake-2.8.4]#./bootstrap
没有报错,编译装置
[root@localhostcmake-2.8.4]#gmake
[root@localhostcmake-2.8.4]#gmakeinstall
4.正式开端装置MySQL
添加MySQL用户和用户组
[root@localhost~]#groupaddmysql
[root@localhost~]#useradd-gmysqlmysql
MySQL源码包从同享文件夹移至/usr并解压
[root@localhost~]mv/mnt/hgfs/Share-CentOS/mysql-5.5.22.tar.gz/usr/mysql-5.5.22.tar.gz
[root@localhostusr]#tarxzvfmysql-5.5.22.tar.gz
[root@localhostusr]#cdmysql-5.5.22
Cmake运转
[root@localhostmysql-5.5.22]#cmake.
开端编译装置
[root@localhostmysql-5.5.22]#make&&makeinstall
进入装置目次,将法式二进制的一切权改成root,数据目次的说有权改成mysql用户,更新受权表
[root@localhostmysql-5.5.22]#cd/usr/local/mysql/
[root@localhostmysql]#chown-Rroot.
[root@localhostmysql]#chown-Rmysql.
[root@localhostmysql]#chgrp-Rmysql.
[root@localhostmysql]#scripts/mysql_install_db--user=mysql
平安启动MySQL(默许暗码为空)
[root@localhostmysql]#./bin/mysqld_safe--user=mysql&
报错:
12090800:16:25mysqld_safeLoggingto/usr/local/mysql/data/CentOS.err.
12090800:16:26mysqld_safeStartingmysqlddaemonwithdatabasesfrom/usr/local/mysql/data
处理办法:
[root@CentOS~]#cd/usr/local/mysql/data
[root@CentOSdata]#ls-l
总用量29744
-rw-rw----1mysqlroot15859月800:16CentOS.err
-rw-rw----1mysqlmysql69月800:16CentOS.pid
-rw-rw----1mysqlmysql188743689月800:16ibdata1
-rw-rw----1mysqlmysql52428809月800:16ib_logfile0
-rw-rw----1mysqlmysql52428809月800:16ib_logfile1
drwxr-xr-x2mysqlmysql40969月800:14mysql
-rw-rw----1mysqlmysql272939月800:14mysql-bin.000001
-rw-rw----1mysqlmysql10318929月800:14mysql-bin.000002
-rw-rw----1mysqlmysql1079月800:16mysql-bin.000003
-rw-rw----1mysqlmysql579月800:16mysql-bin.index
drwx------2mysqlmysql40969月800:14performance_schema
drwxr-xr-x2mysqlmysql40969月800:08test
[root@CentOSdata]#chgrp-RmysqlCentOS.err
[root@CentOSdata]#ls-l
总用量29736
-rw-rw----1mysqlmysql15859月800:16CentOS.err
-rw-rw----1mysqlmysql69月800:16CentOS.pid
-rw-rw----1mysqlmysql188743689月800:16ibdata1
-rw-rw----1mysqlmysql52428809月800:16ib_logfile0
-rw-rw----1mysqlmysql52428809月800:16ib_logfile1
drwxr-xr-x2mysqlmysql40969月800:14mysql
-rw-rw----1mysqlmysql272939月800:14mysql-bin.000001
-rw-rw----1mysqlmysql10318929月800:14mysql-bin.000002
-rw-rw----1mysqlmysql1079月800:16mysql-bin.000003
-rw-rw----1mysqlmysql579月800:16mysql-bin.index
drwx------2mysqlmysql40969月800:14performance_schema
drwxr-xr-x2mysqlmysql40969月800:08test
衔接本机MySQL
[root@localhostmysql]#mysqlCurootCp
提醒输出password,默许为空,按Enter便可
断开衔接
mysql>exit;
为root账户设置暗码
[root@localhost~]#cd/usr/local/mysql/bin
[root@localhostmysql]#./bin/mysqladmin-urootpassword123456
EnterPassword:123456
设置选项文件,将设置装备摆设文件拷贝到/etc下
[root@localhostmysql]#cpsupport-files/my-medium.cnf/etc/mysql.cnf
设置开机自启动
[root@localhostmysql]#cpsupport-files/mysql.server/etc/init.d/mysql
[root@localhostmysql]#chmod+x/etc/init.d/mysql
经由过程办事来启动和封闭Mysql
[root@localhost~]#servicemysqlstart
[root@localhost~]#servicemysqlstop
5.装置设置终了,以后应用只需启动-衔接-断开-封闭,敕令以下:
[root@CentOSmysql]#servicemysqlstart
StartingMySQL..[肯定]
[root@CentOSmysql]#mysql-uroot-p
Enterpassword:
WelcometotheMySQLmonitor.Commandsendwith;org.
YourMySQLconnectionidis1
Serverversion:5.5.22Sourcedistribution
Copyright(c)2000,2011,Oracleand/oritsaffiliates.Allrightsreserved.
OracleisaregisteredtrademarkofOracleCorporationand/orits
affiliates.Othernamesmaybetrademarksoftheirrespective
owners.
Typehelp;orhforhelp.Typectoclearthecurrentinputstatement.
mysql>showdatabases;
+--------------------+
|Database|
+--------------------+
|information_schema|
|mysql|
|performance_schema|
|test|
+--------------------+
4rowsinset(0.07sec)
mysql>exit;
Bye
[root@CentOSmysql]#servicemysqlstop
ShuttingdownMySQL.[肯定]
6.其它:
检查过程敕令psCef|grepmysqld
kill过程敕令killC9过程号
小知识:Linux是一个基于POSIX和UNIX的多用户、多任务、支持多线程和多CPU的操作系统。 |
|