centos6.6下編輯安裝mysql-5.6.21

來源:互聯網
上載者:User

標籤:官方網站   linux   local   帳號   mysql   

參考以下連結:

http://blog.csdn.net/wendi_0506/article/details/39478369

1.進入MySQL官方網站(下載需申請帳號),下載源碼包。下載tar包下來再上傳到Linux機器上面,或在Linux上面下載。650) this.width=650;" title="centos6.6下編輯安裝mysql-5.6.21" name="image_operate_92541415713733868" alt="centos6.6下編輯安裝mysql-5.6.21" src="http://s13.sinaimg.cn/mw690/003SgaQkgy6Nxa5LIte1c&690" width="690" height="338" />

650) this.width=650;" title="centos6.6下編輯安裝mysql-5.6.21" name="image_operate_56571415713734219" alt="centos6.6下編輯安裝mysql-5.6.21" src="http://s14.sinaimg.cn/mw690/003SgaQkgy6Nxa5Piqhdd&690" width="690" height="32" />

650) this.width=650;" title="centos6.6下編輯安裝mysql-5.6.21" name="image_operate_36771415717435156" alt="centos6.6下編輯安裝mysql-5.6.21" src="http://s9.sinaimg.cn/mw690/003SgaQkgy6Nxa5YYYg78&690" width="690" height="384" />

2.yuminstallgccgcc-c++ncurses-develperl cmake -y

3. useradd -M-s /sbin/nologinmysql

4.mkdir-p/usr/local/mysql

5.cmake \
DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=usr/local/mysq/data/mysqldb \
-DMYSQL_TCP_PORT=3306 \
-DENABLE_DOWNLOADS=1

(重新回合組態,需要刪除CMakeCache.txt檔案。:make clean; rmCMakeCache.txt)

參數部分可參考:http://www.blogjava.net/kelly859/archive/2012/09/04/387005.html

6.make;make install;

7.chown-Rvmysql:mysql /usr/local/mysql

8./usr/local/mysql/scripts/mysql_install_db--user=mysql--datadir=/usr/local/mysql/data/mysqldb

當MySQL的系統庫(mysql系統庫)發生故障或需要新加一個mysql執行個體時,需要初始化mysql資料庫,產生授權表,不覆蓋已有的MySQL授權表,並且它不影響任何其它資料。

授權表的介紹 http://www.searchdatabase.com.cn/showcontent_31062.htm

http://www.linuxidc.com/Linux/2013-07/88024.htm

9. cp/usr/local/mysql/support-files/my-default.cnf/etc/my.cnf (複製設定檔,並進行修改)

cpsupport-files/mysql.server/etc/init.d/mysqld(複製啟動指令碼)

650) this.width=650;" title="centos6.6下編輯安裝mysql-5.6.21" name="image_operate_16921415890185190" alt="centos6.6下編輯安裝mysql-5.6.21" src="http://s10.sinaimg.cn/mw690/003SgaQkgy6NAq5iiP7a9&690" width="566" height="315" />

10.修改環境變數,讓mysql可以自動識別。

vim /etc/profile

PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH

export PATH

source /etc/profile

650) this.width=650;" title="centos6.6下編輯安裝mysql-5.6.21" name="image_operate_27251415890474113" alt="centos6.6下編輯安裝mysql-5.6.21" src="http://s4.sinaimg.cn/mw690/003SgaQkgy6NAqvYvrZ93&690" width="418" height="254" />

11.service mysqld start

mysql-uroot-p

初始密碼一般為空白,能登陸上說明已成功。

12.mysqladmin-urootpassword ‘123456‘(可以使用mysqladmin來修改使用者的密碼)

生產資料庫建議運行,/usr/local/mysql/bin/mysql_secure_installation

來執行幾個設定:
a)為root使用者佈建密碼
b)刪除匿名帳號
c)取消root使用者遠程登入
d)刪除test庫和對test庫的存取權限
e)重新整理授權表使修改生效

http://www.jb51.net/article/47727.htm

13.啟動mysql服務並加入開機自啟動(可選這個步驟,以後可以自己啟動的)

service mysqld start
chkconfig --level 35 mysqld on


centos6.6下編輯安裝mysql-5.6.21

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.