一区二区三区|亚洲午夜,97久久视频,黄动漫视频高清在线http://www.aygfsteel.com/hellxoul/category/50245.htmlzh-cnMon, 16 Jun 2014 03:57:27 GMTMon, 16 Jun 2014 03:57:27 GMT60數(shù)據(jù)庫(kù)事務(wù)隔離級(jí)別http://www.aygfsteel.com/hellxoul/archive/2014/06/15/414771.htmlhellxoulhellxoulSun, 15 Jun 2014 07:15:00 GMThttp://www.aygfsteel.com/hellxoul/archive/2014/06/15/414771.htmlhttp://www.aygfsteel.com/hellxoul/comments/414771.htmlhttp://www.aygfsteel.com/hellxoul/archive/2014/06/15/414771.html#Feedback0http://www.aygfsteel.com/hellxoul/comments/commentRss/414771.htmlhttp://www.aygfsteel.com/hellxoul/services/trackbacks/414771.html轉(zhuǎn)自:http://singo107.iteye.com/blog/1175084

數(shù)據(jù)庫(kù)事務(wù)的隔離級(jí)別有4個(gè),由低到高依次為Read uncommitted 、Read committed 、Repeatable read 、Serializable ,這四個(gè)級(jí)別可以逐個(gè)解決臟讀 、不可重復(fù)讀 、幻讀 這幾類問題。


√: 可能出現(xiàn)    ×: 不會(huì)出現(xiàn)

臟讀不可重復(fù)讀幻讀
Read uncommitted
Read committed×
Repeatable read××
Serializable×××

 

注意:我們討論隔離級(jí)別的場(chǎng)景,主要是在多個(gè)事務(wù)并發(fā) 的情況下,因此,接下來(lái)的講解都圍繞事務(wù)并發(fā)。

Read uncommitted 讀未提交

公司發(fā)工資了,領(lǐng)導(dǎo)把5000元打到singo的賬號(hào)上,但是該事務(wù)并未提交,而singo正好去查看賬戶,發(fā)現(xiàn)工資已經(jīng)到賬,是5000元整,非常高 興。可是不幸的是,領(lǐng)導(dǎo)發(fā)現(xiàn)發(fā)給singo的工資金額不對(duì),是2000元,于是迅速回滾了事務(wù),修改金額后,將事務(wù)提交,最后singo實(shí)際的工資只有 2000元,singo空歡喜一場(chǎng)。


 

出現(xiàn)上述情況,即我們所說的臟讀 ,兩個(gè)并發(fā)的事務(wù),“事務(wù)A:領(lǐng)導(dǎo)給singo發(fā)工資”、“事務(wù)B:singo查詢工資賬戶”,事務(wù)B讀取了事務(wù)A尚未提交的數(shù)據(jù)。

當(dāng)隔離級(jí)別設(shè)置為Read uncommitted 時(shí),就可能出現(xiàn)臟讀,如何避免臟讀,請(qǐng)看下一個(gè)隔離級(jí)別。

Read committed 讀提交

singo拿著工資卡去消費(fèi),系統(tǒng)讀取到卡里確實(shí)有2000元,而此時(shí)她的老婆也正好在網(wǎng)上轉(zhuǎn)賬,把singo工資卡的2000元轉(zhuǎn)到另一賬戶,并在 singo之前提交了事務(wù),當(dāng)singo扣款時(shí),系統(tǒng)檢查到singo的工資卡已經(jīng)沒有錢,扣款失敗,singo十分納悶,明明卡里有錢,為 何......

出現(xiàn)上述情況,即我們所說的不可重復(fù)讀 ,兩個(gè)并發(fā)的事務(wù),“事務(wù)A:singo消費(fèi)”、“事務(wù)B:singo的老婆網(wǎng)上轉(zhuǎn)賬”,事務(wù)A事先讀取了數(shù)據(jù),事務(wù)B緊接了更新了數(shù)據(jù),并提交了事務(wù),而事務(wù)A再次讀取該數(shù)據(jù)時(shí),數(shù)據(jù)已經(jīng)發(fā)生了改變。

當(dāng)隔離級(jí)別設(shè)置為Read committed 時(shí),避免了臟讀,但是可能會(huì)造成不可重復(fù)讀。

大多數(shù)數(shù)據(jù)庫(kù)的默認(rèn)級(jí)別就是Read committed,比如Sql Server , Oracle。如何解決不可重復(fù)讀這一問題,請(qǐng)看下一個(gè)隔離級(jí)別。

Repeatable read 重復(fù)讀

當(dāng)隔離級(jí)別設(shè)置為Repeatable read 時(shí),可以避免不可重復(fù)讀。當(dāng)singo拿著工資卡去消費(fèi)時(shí),一旦系統(tǒng)開始讀取工資卡信息(即事務(wù)開始),singo的老婆就不可能對(duì)該記錄進(jìn)行修改,也就是singo的老婆不能在此時(shí)轉(zhuǎn)賬。

雖然Repeatable read避免了不可重復(fù)讀,但還有可能出現(xiàn)幻讀 。

singo的老婆工作在銀行部門,她時(shí)常通過銀行內(nèi)部系統(tǒng)查看singo的信用卡消費(fèi)記錄。有一天,她正在查詢到singo當(dāng)月信用卡的總消費(fèi)金額 (select sum(amount) from transaction where month = 本月)為80元,而singo此時(shí)正好在外面胡吃海塞后在收銀臺(tái)買單,消費(fèi)1000元,即新增了一條1000元的消費(fèi)記錄(insert transaction ... ),并提交了事務(wù),隨后singo的老婆將singo當(dāng)月信用卡消費(fèi)的明細(xì)打印到A4紙上,卻發(fā)現(xiàn)消費(fèi)總額為1080元,singo的老婆很詫異,以為出 現(xiàn)了幻覺,幻讀就這樣產(chǎn)生了。

注:Mysql的默認(rèn)隔離級(jí)別就是Repeatable read。

Serializable 序列化

Serializable 是最高的事務(wù)隔離級(jí)別,同時(shí)代價(jià)也花費(fèi)最高,性能很低,一般很少使用,在該級(jí)別下,事務(wù)順序執(zhí)行,不僅可以避免臟讀、不可重復(fù)讀,還避免了幻像讀。



]]>
CentOS 6.3下MySQL 5.6源碼安裝http://www.aygfsteel.com/hellxoul/archive/2013/05/17/399411.htmlhellxoulhellxoulFri, 17 May 2013 07:20:00 GMThttp://www.aygfsteel.com/hellxoul/archive/2013/05/17/399411.htmlhttp://www.aygfsteel.com/hellxoul/comments/399411.htmlhttp://www.aygfsteel.com/hellxoul/archive/2013/05/17/399411.html#Feedback0http://www.aygfsteel.com/hellxoul/comments/commentRss/399411.htmlhttp://www.aygfsteel.com/hellxoul/services/trackbacks/399411.htmlLinux操作系統(tǒng):CentOS 6.3
1:下載:當(dāng)前mysql版本到了5.6.10
  
 下載地址:http://dev.mysql.com/downloads/mysql/5.6.html#downloads
  
 選擇“Source Code”
  
在此之前最好注冊(cè)一個(gè)Oracle賬號(hào)
  
 2:必要軟件包
yum -y install  gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* make cmake 
3:編譯安裝
[root@server182 ~]# groupadd mysql 
[root@server182 ~]# useradd -r -g mysql mysql 
[root@server182 ~]# tar -zxvf mysql-5.6.10.tar.gz 
[root@server182 ~]# cd mysql-5.6.10 
[root@server182 mysql-5.6.10]# cmake . 
[root@server182 mysql-5.6.10]# make && make install 
-------------------------默認(rèn)情況下是安裝在/usr/local/mysql 
[root@server182 ~]# chown -R mysql.mysql /usr/local/mysql 
[root@server182 ~]# cd /usr/local/mysql/scripts 
[root@server182 ~]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data 
[root@server182 ~]# cd /usr/local/mysql/support-files 
[root@server182 support-files]# cp mysql.server /etc/rc.d/init.d/mysql 
[root@server182 support-files]# cp my-default.cnf /etc/my.cnf 
[root@server182 ~]# chkconfig -add mysql 
[root@server182 ~]# chkconfig mysql on 
[root@server182 ~]# service mysql start 
Starting MySQL SUCCESS!  
[root@server182 support-files]# mysql 
Welcome to the MySQL monitor.  Commands end with ; or \g. 
Your MySQL connection id is 1 
Server version: 5.6.10 Source distribution 
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 
  
Oracle is a registered trademark of Oracle Corporation and/or its 
affiliates. Other names may be trademarks of their respective 
owners. 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 
 
mysql>  
mysql> status; 
-------------- 
mysql  Ver 14.14 Distrib 5.6.10, for Linux (i686) using  EditLine wrapper 
Connection id:  1 
Current database:  
Current user:  root@localhost 
SSL:    Not in use 
Current pager:  stdout 
Using outfile:  '' 
Using delimiter:  ; 
Server version:  5.6.10 Source distribution 
Protocol version:  10 
Connection:  Localhost via UNIX socket 
Server characterset:  utf8 
Db    characterset:  utf8 
Client characterset:  utf8 
Conn.  characterset:  utf8 
UNIX socket:  /tmp/mysql.sock 
Uptime:    5 min 45 sec 
  
Threads: 1  Questions: 5  Slow queries: 0  Opens: 70  Flush tables: 1  Open tables: 63  Queries per second avg: 0.014 
------------- 
mysql>  
安裝完畢。
原文鏈接:http://www.linuxidc.com/Linux/2013-02/79791.htm


]]>
CentOS 6.3/6.4 Minimal 源碼安裝 MySQL 5.6.10/5.6.11http://www.aygfsteel.com/hellxoul/archive/2013/05/17/399410.htmlhellxoulhellxoulFri, 17 May 2013 07:18:00 GMThttp://www.aygfsteel.com/hellxoul/archive/2013/05/17/399410.htmlhttp://www.aygfsteel.com/hellxoul/comments/399410.htmlhttp://www.aygfsteel.com/hellxoul/archive/2013/05/17/399410.html#Feedback0http://www.aygfsteel.com/hellxoul/comments/commentRss/399410.htmlhttp://www.aygfsteel.com/hellxoul/services/trackbacks/399410.htmlMySQL 5.6正式版發(fā)布了,相對(duì)于5.5版本作出了不少改進(jìn),其源碼安裝配置方式也有所變化,本文根據(jù)實(shí)際操作,不斷嘗試,精確還原了安裝的具體步驟。

環(huán)境:CentOS 6.3/6.4 最小化缺省安裝,配置好網(wǎng)卡。

安裝MySQL前,確認(rèn)Internet連接正常,以便下載安裝文件。

先使用 yum -y update 指令升級(jí)系統(tǒng)到最新版本。

本安裝將MySQL的數(shù)據(jù)文件與執(zhí)行文件分離,如果你打算設(shè)置到不同的路徑,注意修改對(duì)應(yīng)的執(zhí)行命令和數(shù)據(jù)庫(kù)初始化腳本。

# 修改防火墻設(shè)置,打開3306端口
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

# 重啟防火墻使新設(shè)置生效
service iptables restart

# 新增用戶組
groupadd mysql

# 新增用戶
useradd mysql -g mysql

# 新建數(shù)據(jù)庫(kù)執(zhí)行文件目錄
mkdir -p /usr/local/mysql

# 新建數(shù)據(jù)庫(kù)數(shù)據(jù)文件目錄
mkdir -p /db/mysql/data

# 編輯PATH搜索路徑
vi /etc/profile
Append these 2 lines to the end of the file:
PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH
export PATH

# 生效PATH搜索路徑
source /etc/profile

# 編輯hosts文件,加入本機(jī)IP和主機(jī)名
vi /etc/hosts
192.168.211.100      centhost.centdomain

# 安裝編譯源碼所需的工具和庫(kù)
yum -y install wget gcc-c++ ncurses-devel cmake make perl

# 進(jìn)入源碼壓縮包下載目錄
cd /usr/local/src

# 下載源碼壓縮包,下載包34M大小,有點(diǎn)慢,等吧。
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.10.tar.gz/from/http://cdn.mysql.com/

# 解壓縮源碼包
tar -zxvf mysql-5.6.10.tar.gz

# 進(jìn)入解壓縮源碼目錄
cd mysql-5.6.10

# 從mysql5.5起,mysql源碼安裝開始使用cmake了,執(zhí)行源碼編譯配置腳本。

cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/db/mysql/data \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3306

# 編譯源碼,這一步時(shí)間會(huì)較長(zhǎng),耐心等待。
make

# 安裝
make install

# 清除安裝臨時(shí)文件
make clean

# 修改目錄擁有者
chown -R mysql:mysql /usr/local/mysql
chown -R mysql:mysql /db/mysql/data

# 進(jìn)入安裝路徑
cd /usr/local/mysql

# 執(zhí)行初始化配置腳本,創(chuàng)建系統(tǒng)自帶的數(shù)據(jù)庫(kù)和表。
scripts/mysql_install_db --user=mysql --datadir=/db/mysql/data
初始化腳本在 /usr/local/mysql/my.cnf 生成了配置文件。需要更改該配置文件的所有者:
chown -R mysql:mysql /usr/local/mysql
多說兩句:在啟動(dòng)MySQL服務(wù)時(shí),會(huì)按照一定次序搜索my.cnf,先在/etc目錄下找,找不到則會(huì)搜索"$basedir/my.cnf",在本例中就是 /usr/local/mysql/my.cnf,這是新版MySQL的配置文件的默認(rèn)位置!注意:在CentOS 6.4版操作系統(tǒng)的最小安裝完成后,在/etc目錄下會(huì)存在一個(gè)my.cnf,需要將此文件更名為其他的名字,如:/etc/my.cnf.bak,否則,該文件會(huì)干擾源碼安裝的MySQL的正確配置,造成無(wú)法啟動(dòng)。

# 復(fù)制服務(wù)啟動(dòng)腳本
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql

# 啟動(dòng)MySQL服務(wù)
service mysql start

# 設(shè)置開機(jī)自動(dòng)啟動(dòng)服務(wù)
chkconfig mysql on

# 修改MySQL用戶root的密碼
mysql -u root

mysql>use mysql;
mysql>GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "root";
mysql>update user set Password = password('123456') where User='root';
mysql>flush privileges;
mysql>exit;

# 可選:運(yùn)行安全設(shè)置腳本,修改MySQL用戶root(不是系統(tǒng)的root!)的密碼,禁止root遠(yuǎn)程連接(防止破解密碼),移除test數(shù)據(jù)庫(kù)和匿名用戶,強(qiáng)烈建議生產(chǎn)服務(wù)器使用:

/usr/local/mysql/bin/mysql_secure_installation

 

后記:

2013年3月18日更新:
如果要使Windows平臺(tái)下的MySQL和Linux平臺(tái)下的MySQL協(xié)同工作,你需要設(shè)置Linux平臺(tái)下的全局變量lower_case_table_names=1,強(qiáng)制將數(shù)據(jù)表名稱轉(zhuǎn)換為小寫(大小寫不敏感)。參考我另一篇博文:http://www.cnblogs.com/jlzhou/archive/2013/03/18/2966106.html

 

 
>>>>> 版權(quán)沒有 >>>>> 歡迎轉(zhuǎn)載 >>>>> 原文地址 >>>>> http://www.cnblogs.com/jlzhou >>>>> 雄鷹在雞窩里長(zhǎng)大,就會(huì)失去飛翔的本領(lǐng),野狼在羊群里成長(zhǎng),也會(huì)愛上羊而喪失狼性。人生的奧妙就在于與人相處。生活的美好則在于送人玫瑰。和聰明的人在一起,你才會(huì)更加睿智。和優(yōu)秀的人在一起,你才會(huì)出類拔萃。所以,你是誰(shuí)并不重要,重要的是,你和誰(shuí)在一起。


]]>
CentOS6.3安裝MySQL5.6http://www.aygfsteel.com/hellxoul/archive/2013/02/24/395639.htmlhellxoulhellxoulSat, 23 Feb 2013 16:31:00 GMThttp://www.aygfsteel.com/hellxoul/archive/2013/02/24/395639.htmlhttp://www.aygfsteel.com/hellxoul/comments/395639.htmlhttp://www.aygfsteel.com/hellxoul/archive/2013/02/24/395639.html#Feedback1http://www.aygfsteel.com/hellxoul/comments/commentRss/395639.htmlhttp://www.aygfsteel.com/hellxoul/services/trackbacks/395639.html 我下載的版本:mysql-5.5.22.tar.gz

2.安裝之前先卸載CentOS自帶的MySQL
[root@localhost ~]# yum remove mysql

3.編譯安裝Cmake
下載cmake源碼包:http://www.cmake.org/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@localhost usr]# tar xzvf cmake-2.8.4.tar.gz
[root@localhost usr]# cd cmake-2.8.4
[root@localhost cmake-2.8.4]# ./bootstrap

---------------------------------------------
CMake 2.8.4, Copyright 2000-2009 Kitware, Inc.
---------------------------------------------
Error when bootstrapping CMake:
Cannot find appropriate C compiler on this system.
Please specify one using environment variable CC.
See cmake_bootstrap.log for compilers attempted.

---------------------------------------------
Log of errors: /usr/local/src/cmake-2.8.4/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------
報(bào)錯(cuò):缺少C的編譯器
解決辦法:安裝gcc編譯器
[root@localhost ~]# yum install gcc

繼續(xù)安裝Cmake
[root@localhost cmake-2.8.4]# ./bootstrap

---------------------------------------------
CMake 2.8.4, Copyright 2000-2009 Kitware, Inc.
C compiler on this system is: cc
---------------------------------------------
Error when bootstrapping CMake:
Cannot find appropriate C++ compiler on this system.
Please specify one using environment variable CXX.
See cmake_bootstrap.log for compilers attempted.
---------------------------------------------
Log of errors: /usr/local/src/cmake-2.8.4/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------
報(bào)錯(cuò):缺少C++編譯器
解決辦法:安裝gcc-c++編譯器
[root@localhost ~]# yum install gcc-c++

再次安裝
[root@localhost cmake-2.8.4]# ./bootstrap
沒有報(bào)錯(cuò),編譯安裝
[root@localhost cmake-2.8.4]# gmake
[root@localhost cmake-2.8.4]# gmake install

4.正式開始安裝MySQL
添加MySQL用戶和用戶組
[root@localhost ~]# groupadd mysql
[root@localhost ~]# useradd -g mysql mysql

MySQL源碼包從共享文件夾移至/usr并解壓
[root@localhost ~]mv /mnt/hgfs/Share-CentOS/mysql-5.5.22.tar.gz /usr/mysql-5.5.22.tar.gz
[root@localhost usr]# tar xzvf mysql-5.5.22.tar.gz
[root@localhost usr]# cd mysql-5.5.22

Cmake運(yùn)行
[root@localhost mysql-5.5.22]# cmake .

開始編譯安裝
[root@localhost mysql-5.5.22]# make && make install

進(jìn)入安裝目錄,將程序二進(jìn)制的所有權(quán)改為root,數(shù)據(jù)目錄的說有權(quán)改為mysql用戶,更新授權(quán)表
[root@localhost mysql-5.5.22]# cd /usr/local/mysql/
[root@localhost mysql]# chown -R root .
[root@localhost mysql]# chown -R mysql .
[root@localhost mysql]# chgrp -R mysql .
[root@localhost mysql]# scripts/mysql_install_db --user=mysql

安全啟動(dòng)MySQL(默認(rèn)密碼為空)
[root@localhost mysql]#./bin/mysqld_safe --user=mysql&

報(bào)錯(cuò):

120908 00:16:25 mysqld_safe Logging to '/usr/local/mysql/data/CentOS.err'.
120908 00:16:26 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

解決方法:
[root@CentOS ~]# cd /usr/local/mysql/data

[root@CentOS data]# ls -l
總用量 29744
-rw-rw---- 1 mysql root 1585 9月 8 00:16 CentOS.err
-rw-rw---- 1 mysql mysql 6 9月 8 00:16 CentOS.pid
-rw-rw---- 1 mysql mysql 18874368 9月 8 00:16 ibdata1
-rw-rw---- 1 mysql mysql 5242880 9月 8 00:16 ib_logfile0
-rw-rw---- 1 mysql mysql 5242880 9月 8 00:16 ib_logfile1
drwxr-xr-x 2 mysql mysql 4096 9月 8 00:14 mysql
-rw-rw---- 1 mysql mysql 27293 9月 8 00:14 mysql-bin.000001
-rw-rw---- 1 mysql mysql 1031892 9月 8 00:14 mysql-bin.000002
-rw-rw---- 1 mysql mysql 107 9月 8 00:16 mysql-bin.000003
-rw-rw---- 1 mysql mysql 57 9月 8 00:16 mysql-bin.index
drwx------ 2 mysql mysql 4096 9月 8 00:14 performance_schema
drwxr-xr-x 2 mysql mysql 4096 9月 8 00:08 test
[root@CentOS data]# chgrp -R mysql CentOS.err
[root@CentOS data]# ls -l
總用量 29736
-rw-rw---- 1 mysql mysql 1585 9月 8 00:16 CentOS.err
-rw-rw---- 1 mysql mysql 6 9月 8 00:16 CentOS.pid
-rw-rw---- 1 mysql mysql 18874368 9月 8 00:16 ibdata1
-rw-rw---- 1 mysql mysql 5242880 9月 8 00:16 ib_logfile0
-rw-rw---- 1 mysql mysql 5242880 9月 8 00:16 ib_logfile1
drwxr-xr-x 2 mysql mysql 4096 9月 8 00:14 mysql
-rw-rw---- 1 mysql mysql 27293 9月 8 00:14 mysql-bin.000001
-rw-rw---- 1 mysql mysql 1031892 9月 8 00:14 mysql-bin.000002
-rw-rw---- 1 mysql mysql 107 9月 8 00:16 mysql-bin.000003
-rw-rw---- 1 mysql mysql 57 9月 8 00:16 mysql-bin.index
drwx------ 2 mysql mysql 4096 9月 8 00:14 performance_schema
drwxr-xr-x 2 mysql mysql 4096 9月 8 00:08 test

連接本機(jī)MySQL
[root@localhost mysql]#mysql –u root –p
提示輸入password,默認(rèn)為空,按Enter即可

斷開連接
mysql>exit;

為root賬戶設(shè)置密碼
[root@localhost ~]# cd /usr/local/mysql/bin
[root@localhost mysql]# ./bin/mysqladmin -u root password 123456
Enter Password:123456

設(shè)置選項(xiàng)文件,將配置文件拷貝到/etc下
[root@localhost mysql]# cp support-files/my-medium.cnf /etc/mysql.cnf

設(shè)置開機(jī)自啟動(dòng)
[root@localhost mysql]# cp support-files/mysql.server /etc/init.d/mysql
[root@localhost mysql]# chmod +x /etc/init.d/mysql

[root@localhost mysql]# chkconfig mysql on
 


通過服務(wù)來(lái)啟動(dòng)和關(guān)閉Mysql
[root@localhost ~]# service mysql start
[root@localhost ~]# service mysql stop

5.安裝設(shè)置完畢,之后使用只需啟動(dòng)-連接-斷開-關(guān)閉,命令如下:
[root@CentOS mysql]# service mysql start
Starting MySQL.. [確定]
[root@CentOS mysql]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.22 Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.07 sec)

mysql> exit;
Bye
[root@CentOS mysql]# service mysql stop
Shutting down MySQL. [確定]

6.其它:
查看進(jìn)程命令 ps –ef|grep mysqld
kill進(jìn)程命令 kill –9 進(jìn)程號(hào)

]]>
主站蜘蛛池模板: 含山县| 宁乡县| 阜康市| 开化县| 汽车| 桐梓县| 宜兰市| 云霄县| 湘潭县| 元朗区| 三门县| 巢湖市| 襄垣县| 巴彦淖尔市| 察隅县| 苗栗市| 夹江县| 威远县| 万源市| 成武县| 荆州市| 进贤县| 神池县| 灵寿县| 台湾省| 常宁市| 宽城| 安岳县| 芷江| 莆田市| 吉隆县| 肇源县| 都江堰市| 穆棱市| 长寿区| 泾阳县| 达尔| 新闻| 朝阳县| 宝应县| 缙云县|