mysql啟動過程

來源:互聯網
上載者:User

標籤:error   mysql   知識   

  1. 明白/etc/init.d/mysql從哪裡來,和mysql.server什麼關係?

  2. /etc/init.d/mysql和mysqld_safe之間的關係

  3. mysqld_safe怎麼把mysql啟動起來的


  1. mysql就是mysql.server拷貝到這裡來的。

  2. mysql啟動,調用mysqld_safe

  3. mysqld_safe調用mysqld將mysql啟動起來。


    擴充知識:mysqld_safe是mysqld的一個看門狗進程

    ps -axu | grep mysql找到mysql的pid

    kill -9 pid

    ps -axu | grep mysql發現又產生了一個mysql的進程。可以參考mysqld_safe的這一特點,自動啟動那些掛掉的應用。



    mysql啟動過程:mysql.server調用mysqld_safe,mysqld_safe調用mysqld進程。一般mysql啟動出現故障,我們需要去error.log查看error即可。但是有的時候mysql啟動報錯,但是確沒有寫進日誌,那麼怎麼辦呢?


    首先vim /etc/init.d/mysql,加入set -x。

    /etc/init.d/mysql start >> start.log 2>&1。可查看mysql啟動shell--start.log。


    啟用my.cnf參數malloc-lib=/usr/local/mysql/lib/mysql/libjemalloc.so,發現mysql起不來了。而且error.log日誌也沒有報錯資訊。心慌了,怎麼辦。

    vim /etc/init.d/mysql中指令碼, $bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null 2>&1 & 把底線部分去掉,讓開機記錄重新導向到終端。這時候再啟動就會有報錯資訊了,Starting MySQL..150514 06:08:59 mysqld_safe --malloc-lib ‘/usr/local/mysql/lib/mysql/libjemalloc.so‘ can not be read and will not be used

那根據報錯資訊,修改my.cnf檔案,mysql就可以正常啟動了。

本文出自 “7321304” 部落格,轉載請與作者聯絡!

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.