|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
使用gcc或g++进行编译,使用gdb进行调试;
Linux下变动MySQL的数据库目次
明天要在一台双线云主机上安装MySQL数据库,操纵体系为CentOS5.8,由于该机安装的时分/分区只要20G,另有一个300G的扩大磁盘分区挂载在/disk,因而必要将MySQL的数据库目次设置在/disk/mysql,上面是详细操纵步骤。
操纵体系:CentOS5.8
MySQL版本:5.5.25
方针:变动MySQL数据库目次
源目次:/var/lib/mysql(体系默许目次)
方针目次:/disk/mysql
1.安装MySQL数据库软件
假如已有,则跳过。MySQL最新版本为5.5.25
-bash-3.2#rpm-qa|grepMySQL
-bash-3.2#mkdir-psetup
-bash-3.2#cdsetup/
-bash-3.2#wget"http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-client-5.5.25-1.rhel5.i386.rpm/from/http://mirror.csclub.uwaterloo.ca/mysql/"
--2012-06-0616:48:29--http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-client-5.5.25-1.rhel5.i386.rpm/from/http://mirror.csclub.uwaterloo.ca/mysql/
2012-06-0616:49:52(216KB/s)-`MySQL-client-5.5.25-1.rhel5.i386.rpmsaved[17860149/17860149]
-bash-3.2#wget"http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-server-5.5.25-1.rhel5.i386.rpm/from/http://mysql.mirror.iweb.ca/"
--2012-06-0616:50:01--http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-server-5.5.25-1.rhel5.i386.rpm/from/http://mysql.mirror.iweb.ca/
2012-06-0616:57:11(132KB/s)-`MySQL-server-5.5.25-1.rhel5.i386.rpmsaved[54564826/54564826]
-bash-3.2#rpm-ivhMySQL-server-5.5.25-1.rhel5.i386.rpmMySQL-client-5.5.25-1.rhel5.i386.rpm
error:Faileddependencies:
libaio.so.1isneededbyMySQL-server-5.5.25-1.rhel5.i386
libaio.so.1(LIBAIO_0.1)isneededbyMySQL-server-5.5.25-1.rhel5.i386
libaio.so.1(LIBAIO_0.4)isneededbyMySQL-server-5.5.25-1.rhel5.i386
-bash-3.2#yuminstall-ylibaio
Installed:
libaio.i3860:0.3.106-5
Complete!
-bash-3.2#rpm-ivhMySQL-server-5.5.25-1.rhel5.i386.rpmMySQL-client-5.5.25-1.rhel5.i386.rpm
Preparing...###########################################[100%]
1:MySQL-client###########################################[50%]
2:MySQL-server###########################################[100%]
PLEASEREMEMBERTOSETAPASSWORDFORTHEMySQLrootUSER!
Todoso,starttheserver,thenissuethefollowingcommands:
/usr/bin/mysqladmin-urootpasswordnew-password
/usr/bin/mysqladmin-uroot-hlocalhostpasswordnew-password
Alternativelyyoucanrun:
/usr/bin/mysql_secure_installation
whichwillalsogiveyoutheoptionofremovingthetest
databasesandanonymoususercreatedbydefault.Thisis
stronglyrecommendedforproductionservers.
Seethemanualformoreinstructions.
Pleasereportanyproblemswiththe/usr/bin/mysqlbugscript!
-bash-3.2#
2.·中断MySQL服务器
假如MySQL服务器正在运转,应当先将其中断。
我由于刚安装好,以是并未运转。
-bash-3.2#servicemysqlstop
ERROR!MySQLserverPIDfilecouldnotbefound!
-bash-3.2#servicemysqlstatus
ERROR!MySQLisnotrunning
3.挪动数据库目次到方针地位
-bash-3.2#mv/var/lib/mysql/disk
-bash-3.2#ls/disk/
logslost+foundmysql
-bash-3.2#
4.创立或修正设置文件/etc/my.cnf
[client]
default-character-set=gbk
socket=/disk/mysql/mysql.sock
[mysqld]
character-set-server=gbk
socket=/disk/mysql/mysql.sock
5.修正MySQL启动剧本/etc/init.d/mysql
原内容
#Ifyouchangebasedir,youmustalsochangedatadir.Thesemayget
#overwrittenbysettingsintheMySQLconfigurationfiles.
basedir=
datadir=
修正后的内容
#Ifyouchangebasedir,youmustalsochangedatadir.Thesemayget
#overwrittenbysettingsintheMySQLconfigurationfiles.
basedir=
datadir=/disk/mysql
6.启动MySQL服务器
-bash-3.2#servicemysqlstart
StartingMySQL..SUCCESS!
-bash-3.2#servicemysqlstatus
SUCCESS!MySQLrunning(4874)
-bash-3.2#
7.测试MySQL会见是不是一般
-bash-3.2#mysql-p
WelcometotheMySQLmonitor.Commandsendwith;org.
YourMySQLconnectionidis188
Serverversion:5.5.25MySQLCommunityServer(GPL)
Copyright(c)2000,2011,Oracleand/oritsaffiliates.Allrightsreserved.
OracleisaregisteredtrademarkofOracleCorporationand/orits
affiliates.Othernamesmaybetrademarksoftheirrespective
owners.
Typehelp;orhforhelp.Typectoclearthecurrentinputstatement.
mysql>
O.K.!
无论图形界面发展到什么水平这个原理是不会变的,Linux命令有许多强大的功能:从简单的磁盘操作、文件存取、到进行复杂的多媒体图象和流媒体文件的制作。 |
|