linux系統(tǒng)下mysql的安裝步驟

這篇文章主要講解了“l(fā)inux系統(tǒng)下MySQL的安裝步驟”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“l(fā)inux系統(tǒng)下mysql的安裝步驟”吧!

創(chuàng)新互聯(lián)是一家以網(wǎng)絡(luò)技術(shù)公司,為中小企業(yè)提供網(wǎng)站維護(hù)、成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作、網(wǎng)站備案、服務(wù)器租用、域名申請(qǐng)、軟件開發(fā)、成都小程序開發(fā)等企業(yè)互聯(lián)網(wǎng)相關(guān)業(yè)務(wù),是一家有著豐富的互聯(lián)網(wǎng)運(yùn)營推廣經(jīng)驗(yàn)的科技公司,有著多年的網(wǎng)站建站經(jīng)驗(yàn),致力于幫助中小企業(yè)在互聯(lián)網(wǎng)讓打出自已的品牌和口碑,讓企業(yè)在互聯(lián)網(wǎng)上打開一個(gè)面向全國乃至全球的業(yè)務(wù)窗口:建站服務(wù)電話:028-86922220


1:首先下載mysql 二進(jìn)制安裝文件
mysql-5.6.17.tar.gz
存放目錄/u01/soft/mysql-5.6.17.tar.gz
tar -xf mysql-5.6.17.tar.gz
cd mysql-5.6.17
進(jìn)行cmake,但是提示沒有安裝cmake

2:下載cmake
cmake-2.8.10.2.tar.gz
tar -xf cmake-2.8.10.2.tar.gz
./configure
make && make install

3:進(jìn)行cmake
    先創(chuàng)建mysql 安裝目錄以及數(shù)據(jù)文件存放目錄
        mkdir -p /mysql
        mkdir -p /mysql/data
    同時(shí)需要?jiǎng)?chuàng)建mysql 賬號(hào)
        useradd mysql
        passwd mysql
    再進(jìn)行目錄授權(quán):
        chown -R mysql:mysql /mysql
   cd mysql-5.6.17
 cmake \
        -DCMAKE_INSTALL_PREFIX=/mysql/ \               //mysql軟件安裝的根目錄
        -DMYSQL_DATADIR=/mysql/data \                   //mysql 數(shù)據(jù)文件存放目錄
        -DSYSCONFDIR=/etc \                                    //mysql 配置文件(my.cnf)目錄
        -DWITH_MYISAM_STORAGE_ENGINE=1 \         //存儲(chǔ)引擎選項(xiàng)
        -DWITH_INNOBASE_STORAGE_ENGINE=1 \    //以啟用InnoDB、引擎支持:
        -DWITH_MEMORY_STORAGE_ENGINE=1 \
        -DWITH_READLINE=1 \                                 
        -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \   
        -DMYSQL_TCP_PORT=3306 \
        -DENABLED_LOCAL_INFILE=1 \                          //啟用加載本地?cái)?shù)據(jù)
        -DWITH_PARTITION_STORAGE_ENGINE=1 \        
        -DEXTRA_CHARSETS=all \
        -DDEFAULT_CHARSET=utf8 \                           //默認(rèn)字符集
        -DDEFAULT_COLLATION=utf8_general_ci          //字符集校對(duì)
    進(jìn)行編譯,編譯時(shí)報(bào)錯(cuò)如下:
            heck size of wctype_t - done
            -- Check size of wint_t
            -- Check size of wint_t - done
            -- Could NOT find Curses (missing:  CURSES_LIBRARY CURSES_INCLUDE_PATH) 
                CMake Error at cmake/readline.cmake:85 (MESSAGE):
                  Curses library not found.  Please install appropriate package,               remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.
            Call Stack (most recent call first):
              cmake/readline.cmake:128 (FIND_CURSES)
              cmake/readline.cmake:202 (MYSQL_USE_BUNDLED_EDITLINE)
              CMakeLists.txt:411 (MYSQL_CHECK_EDITLINE)
    這個(gè)報(bào)錯(cuò)是提示缺少ncurses-devel依賴包
    進(jìn)行下載:ncurses-devel-5.7-3.20090208.el6.x86_64.rpm
        rpm -ivh ncurses-devel-5.7-3.20090208.el6.x86_64.rpm 
        warning: ncurses-devel-5.7-3.20090208.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
        Preparing...                ########################################### [100%]
       1:ncurses-devel          ########################################### [100%]
    同時(shí)rm -rf CMakeCache.txt 然后進(jìn)行重新cmake
        完成之后,進(jìn)行make && make install 進(jìn)行mysql 安裝
        - Installing: /mysql/man/man1/msql2mysql.1
        -- Installing: /mysql/man/man8/mysqld.8
        -- Installing: /mysql/support-files/solaris/postinstall-solaris
        算安裝完成了,接下來就需要進(jìn)行配置
4: 進(jìn)入到mysql的安裝目錄,/mysql下:進(jìn)行mysql 數(shù)據(jù)庫初始化
        scripts/mysql_install_db --basedir=mysql --datadir=/mysql/data --user=mysql  //初始化mysql數(shù)據(jù)庫
      但是報(bào)錯(cuò)
        [root@db_test scripts]# ./mysql_install_db  --basedir=mysql --datadir=/mysql/data --user=mysql
            FATAL ERROR: Could not find ./bin/my_print_defaults
               cd  /u01/soft/mysql-5.6.17/support-files
         
            cp  my-default.cnf /usr/local/mysql/my.cnf //copy配置文件

            [root@db_test support-files]# chown -R mysql:mysql /mysql
        vi /my.cnf 添加以下內(nèi)容
    [mysqld]
    basedir = /mysql          
    datadir = /mysql/data  
    log-error = /mysql/mysql_error.log          
    pid-file = /mysql/mysql.pid          
    user = mysql
    tmpdir = /tmp 

    初始化mysql數(shù)據(jù)庫
[root@db_test scripts]# ./mysql_install_db  --basedir=/mysql --datadir=/mysql/data --user=mysql
Installing MySQL system tables...2017-05-11 15:01:56 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-05-11 15:01:56 8161 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-05-11 15:01:56 8161 [Note] InnoDB: The InnoDB memory heap is disabled
2017-05-11 15:01:56 8161 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-05-11 15:01:56 8161 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-05-11 15:01:56 8161 [Note] InnoDB: Using CPU crc32 instructions
2017-05-11 15:01:56 8161 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-05-11 15:01:56 8161 [Note] InnoDB: Completed initialization of buffer pool
2017-05-11 15:01:56 8161 [Note] InnoDB: Highest supported file format is Barracuda.
2017-05-11 15:01:56 8161 [Note] InnoDB: Log scan progressed past the checkpoint lsn 1600617
2017-05-11 15:01:56 8161 [Note] InnoDB: Database was not shutdown normally!
2017-05-11 15:01:56 8161 [Note] InnoDB: Starting crash recovery.
2017-05-11 15:01:56 8161 [Note] InnoDB: Reading tablespace information from the .ibd files...
2017-05-11 15:01:56 8161 [Note] InnoDB: Restoring possible half-written data pages 
2017-05-11 15:01:56 8161 [Note] InnoDB: from the doublewrite buffer...

    或使用下列命令把mysql添加為系統(tǒng)服務(wù)
    cd/mysql/support-files/   
    cp ./mysql.server /etc/init.d/mysqld  
    /etc/init.d/mysqld start

    在配置環(huán)境變量
export PATH=$PATH:/mysql/bin

    [mysql@db_test ~]$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.17 Source distribution Copyright (c) 2000, 2014, 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 |
| test               |
+--------------------+
2 rows in set (0.00 sec) mysql> 

感謝各位的閱讀,以上就是“l(fā)inux系統(tǒng)下mysql的安裝步驟”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對(duì)linux系統(tǒng)下mysql的安裝步驟這一問題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!

網(wǎng)站題目:linux系統(tǒng)下mysql的安裝步驟
文章網(wǎng)址:http://muchs.cn/article24/joheje.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供虛擬主機(jī)、定制開發(fā)、企業(yè)網(wǎng)站制作標(biāo)簽優(yōu)化、外貿(mào)網(wǎng)站建設(shè)、自適應(yīng)網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站建設(shè)網(wǎng)站維護(hù)公司