CentOS6.8 x86_64bit源碼安裝MySQL-5.5.47

來源:互聯網
上載者:User

標籤:port   資料   添加mysql   建立   tar   ati   use   源碼安裝   無法啟動   

mysql-5.5.47安裝

1.提前下載源碼包或進入伺服器中上傳源碼包並解壓出來
cd /home/rich/tools
rz -y "mysql-5.5.47-linux2.6-x86_64.tar.gz"
tar xf mysql-5.5.47-linux2.6-x86_64.tar.gz

2.建立mysql資料庫的系統管理使用者並檢查
useradd -s /sbin/nologin mysql -M
id mysql

3.將解壓出來的源碼包移動或複製到到便於自身管理的目錄下並建立軟體連結
mv mysql-5.5.57-linux-glibc2.12-i686 /application/mysql-5.5.57
ln -s /application/mysql-5.5.57/ /application/mysql

4.授權使用者mysql管理mysql的目錄
cd /application/mysql
chown -R mysql.mysql /application/mysql/

5.進入mysql目錄下開始初始化資料庫
./scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql

6.更忙啟動指令檔的預設啟動目錄
cd /application/mysql/bin/
sed -i ‘s#/usr/local/#/application#g‘ mysqld_safe

7.複製mysql設定檔my.cnf到伺服器的配置目錄下
cd /application/mysql
\cp support-files/my-small.cnf /etc/my.cnf

8.由於環境變數的原因直接在命令列輸入mysql是無法啟動mysql資料庫,所以要指定mysql的啟動目錄檔案到伺服器的環境變數中
vi /etc/profile //編輯開機自啟動的設定檔
PATH="/application/mysql/bin:$PATH" >> /etc/profile //添加mysql的啟動目錄檔案到環境變數中
. /etc/profile //命令列執行生效

9.修改啟動指令碼中mysql自定的安裝目錄
cd /application/mysql
sed -i ‘s#/usr/local#/application/#g‘ support-files/mysql.server

10.複製啟動指令碼到伺服器的啟動指令碼目錄下並改名為mysqld
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld //增加mysqld的可執行許可權

11.啟動與停止mysql資料庫
/etc/init.d/mysqld start
/etc/init.d/mysqld stop

12.檢查mysql是否成功啟動
lsof -i :3306 //mysql的預設連接埠3306

13.添加mysqld到開機自啟動
chkconfig --add mysqld

14.給mysql資料建立登陸密碼並使用密碼登陸
mysqladmin password 123456
mysql -uroot -p‘123456‘

CentOS6.8 x86_64bit源碼安裝MySQL-5.5.47

聯繫我們

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