linux下配置mysql解析 遇到新問題兩個。

來源:互聯網
上載者:User

標籤:linux   mysql   local   

  1. 下載mysql到/usr/local/src/

cd /usr/local/src/
wget http://syslab.comsenz.com/downloads/linux/mysql-5.1.40-linux-i686-icc-glibc23.tar.gz
  1. 解壓

[[email protected] src]# tar zxvf /usr/local/src/mysql-5.1.40-linux-i686-icc-glibc23.tar.gz
  1. 把解壓完的資料移動到/usr/local/mysql

[[email protected] src]# mv mysql-5.1.40-linux-i686-icc-glibc23 /usr/local/mysql
  1. 建立mysql使用者

[[email protected] src]# useradd -s /sbin/nologin mysql
  1. 初始化資料庫

[[email protected] src]# cd /usr/local/mysql
[[email protected] mysql]# mkdir -p /data/mysql ; chown -R mysql:mysql /data/mysql
[[email protected] mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql

--user 定義資料庫的所屬主, --datadir 定義資料庫安裝到哪裡,建議放到大空間的分區上,這個目錄需要自行建立。這一步驟很關鍵,如果你看到兩個 “OK” 說明執行正確。

在這裡我之前出現過一個問題   

就是。發現不了檔案。後來打上了一個rmp包
yum -y install libaio libaio-devel

  1. 拷貝設定檔

[[email protected] mysql]# cp support-files/my-large.cnf /etc/my.cnf
  1. 拷貝啟動指令檔並修改其屬性

[[email protected] mysql]# cp support-files/mysql.server  /etc/init.d/mysqld
[[email protected] mysql]# chmod 755 /etc/init.d/mysqld
  1. 修改啟動指令碼

[[email protected] mysql]# vim /etc/init.d/mysqld

需要修改的地方有 “datadir=/data/mysql” (前面初始化資料庫時定義的目錄)

  1. 把啟動指令碼加入系統服務項,並設定開機啟動,啟動mysql

[[email protected] mysql]# chkconfig --add mysqld
[[email protected] mysql]# chkconfig mysqld on
[[email protected] mysql]# service mysqld start

如果啟動不了,請到 /data/mysql/ 下查看錯誤記錄檔,這個日誌通常是主機名稱.err. 檢查mysql是否啟動的命令為:

[[email protected] mysql]# ps aux |grep mysqld


本文出自 “aming-linux學習” 部落格,請務必保留此出處http://937174156.blog.51cto.com/8141519/1725623

linux下配置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.