2015年8月6日 星期四

RHEL7用MariaDB、phpMyAdmin建置資料庫

MariaDB 資料庫建置
1. 安裝 MariaDB 套件
     在「應用程式/系統工具/軟體/搜尋MariaDB」,安裝以下套件
     mariadb-bench
     mariadb-devel
     mariadb-server
     mariadb-test
2. 啟動 MariaDB 服務
    #systemctl enable mariadb.service
    #systemctl start mariadb.service  
    #mysql -u root -p 
    在此先不設定密碼,按 ctrl+c 離開
    出現如下畫面,並留意Server版本
    Welcome to the MariaDB monitor. Commands end with ; or \g.
    Your MariaDB connection id is 2
    Server version: 5.5.35-MariaDB MariaDB Server

phpMyAdmin 建置
1. 下載 phpMyAdmin
    至官網(https://www.phpmyadmin.net/)Download「phpMyAdmin.tar.gz
2. 將檔案拷貝至 /var/www/html,解壓縮、將資料夾重新命名為「phpMyAdmin」
3. 修改文件屬性
    #restorecon -R /var/www/html/phpMyAdmin
3. 安裝 php 套件
    在「應用程式/系統工具/軟體/搜尋php」,安裝以下套件
     php-5.4.16
     php-cli
     php-common
     php-gd
     php-mcrypt
     php-mysql
     php-pdo
4.安裝 web(apache) 套件
    在「應用程式/系統工具/軟體/搜尋httpd」,確認安裝套件  Apache
5. 啟動 httpd 服務
    #systemctl restart httpd.service
    #cd /var/www/html
6. 進入phpMyAdmin頁面
    連至 http://localhost/phpMyAydmin
    顯示缺少 mbstring
7. 下載mbstring
    搜尋「php mbstring centos7 rpm」
    找到 RPM CentOS 7 php-mbstring 5.4.16 x86_64 rpm
   下載「php-mbstring-5.4.15.21 ell7.x86_64.rpm」,點擊便可安裝。
8. 重新啟動 http 服務
    #systemctl restart http.service
    再次連至 http://localhost/phpMyAydmin
    頁面顯示「歡迎使用phpMyAdmin」,但沒有登入帳密

phpMyAdmin初次登入沒有密碼
1. 修改設定檔登入
    將config.sample.inc.php重新命名 config.inc.php
    用gedit編輯檔案
    $cfg['blowfish_secret']='abcdefg';
    引號內可以擺任意字元
    $cfg['Servers'][$i]['AllowNoPassword']=true
    將false改為true,允許root登入不用密碼!
2. 啟動 httpd 服務
    #systemctl restart httpd.service
    再次連至 http://localhost/phpMyAydmin
    即可以 root無密碼登入
3. 登入後,為了安全性起見,先幫root改密碼

RPM CentOS 7 php-mbstring 5.4.16 x86_64 rpm
參考:http://rpm.pbone.net/index.php3/stat/4/idpl/26646085/dir/centos_7/com/php-mbstring-5.4.16-21.el7.x86_64.rpm.html

沒有留言: