【練習】二進位分發安裝mysql

來源:互聯網
上載者:User

標籤:roo   type   enter   建立   unit   copy   oca   linux   建立   

環境描述:

Red Hat Enterprise Linux Server release 6.5

mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz

1.建立使用者和組:

[[email protected] ~]# groupadd -g 1000 mysql[[email protected] ~]# useradd mysql -g mysql -p mysql

2.建立安裝包上傳目錄,將安裝包上傳到該目錄下(上傳過程省略):

[[email protected] ~]# mkdir -p /usr/local/mysql

3.解壓安裝包,解壓後安裝包名稱改為’mysql’:

[[email protected] local]# tar -zxvf mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz[[email protected] local]# mv mysql-5.6.34-linux-glibc2.5-x86_64 mysql

4.解壓的檔案屬主屬組改為root:root,其中data改為mysql:mysql:

[[email protected] ~]# cd /usr/local/mysql[[email protected] mysql]# chown root:root *[[email protected] mysql]# chown mysql:mysql data[[email protected] mysql]# lltotal 68drwxr-xr-x.  2 root  root   4096 Jan  9 22:26 bin-rw-r--r--.  1 root  root  17987 Sep 30 19:41 COPYINGdrwxr-xr-x.  3 mysql mysql  4096 Jan  9 22:26 datadrwxr-xr-x.  2 root  root   4096 Jan  9 22:26 docsdrwxr-xr-x.  3 root  root   4096 Jan  9 22:26 includedrwxr-xr-x.  3 root  root   4096 Jan  9 22:26 libdrwxr-xr-x.  4 root  root   4096 Jan  9 22:26 mandrwxr-xr-x. 10 root  root   4096 Jan  9 22:26 mysql-test-rw-r--r--.  1 root  root   2496 Sep 30 19:41 READMEdrwxr-xr-x.  2 root  root   4096 Jan  9 22:26 scriptsdrwxr-xr-x. 28 root  root   4096 Jan  9 22:26 sharedrwxr-xr-x.  4 root  root   4096 Jan  9 22:26 sql-benchdrwxr-xr-x.  2 root  root   4096 Jan  9 22:26 support-files

5.初始化 建立授權表:

[[email protected] ~]# cd /usr/local/mysql[[email protected] mysql]# scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data

6.編輯設定檔:

[[email protected] ~]# cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf[[email protected] ~]# vi /etc/my.cnf---修改其中的如下內容---basedir = /usr/local/mysqldatadir = /usr/local/mysql/dataport = 3306

7.映射mysql和mysqladmin目錄:

[[email protected] ~]# cd /usr/local/bin[[email protected] bin]# ln -fs /usr/local/mysql/bin/mysql mysql[[email protected] bin]# ln -fs /usr/local/mysql/bin/mysqladmin mysqladmin

8.拷貝mysql.server啟動指令碼到init.d目錄下:

[[email protected] ~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql

9.啟動MySQL Servier:

[[email protected] bin]# service  mysql start

10.修改root使用者的密碼:

mysqladmin -uroot password

11.串連MySQL Server:

[[email protected] bin]# mysql -u root -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 11Server version: 5.6.35 MySQL Community Server (GPL)Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.mysql>

 

【練習】二進位分發安裝mysql

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.