跳轉到內容
View in the app

A better way to browse. Learn more.

PHP論壇人

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

恢復論壇DB資料庫、恢復論壇WWW網站檔案

精選回覆

發表於

恢復論壇DB資料庫、恢復論壇WWW網站檔案

----------------------
將Nginx停止
----------------------

避免恢復網站期間,發生網站備份檔外洩

將Nginx停止

/etc/init.d/nginx stop




---------------------------
恢復資料庫
---------------------------

SFTP將資料庫檔案上傳到 /usr/bin/

cd /usr/bin

解壓縮,得到資料庫檔案

unzip -o DB.zip




---------------------------------------------------------
恢復資料庫
---------------------------------------------------------

cd /usr/bin

mysql -u 使用者名 -p --default-character-set=utf8mb4 資料庫名 < 備份檔名.sql

mysql -u root -p --default-character-set=utf8mb4 xxxxxx_com < DB.sql


Enter password:
輸入資料庫使用者名的密碼


開始恢復資料庫,隨著你的資料庫越大,恢復時間也就越久




-------------------------------
刪除資料庫的備份檔
-------------------------------

cd /usr/bin/


刪除資料庫備份檔

rm DB.zip

rm DB.sql






--------------------------------------
phpMyAdmin做資料維護
--------------------------------------

進入phpMyAdmin

http://伺服器IP:888/phpmyadmin/

瀏覽論壇資料庫的 編碼與排序 是否為 utf8mb4_general_ci 或 utf8mb4_unicode_ci

到論壇資料庫 -> 資料表底部 -> 全選 -> 依次使用

檢查資料表

最佳化資料表


注意:頁碼可能有 2頁 或更多



--------------------------
恢復WWW論壇網站檔案
--------------------------

SFTP上傳 網站備份檔 web.zip

cd /var/www

cd /var/www/域名.com


解壓縮 網站備份檔
unzip -o web.zip



更改網站目錄與檔案的擁有人/群組
chown -R www-data:www-data /var/www/域名.com


確認是否都改為 www-data www-data 
ls -l



修改 conf_global.php 裡的資料庫名、資料庫用戶、資料庫用戶密碼
vi /var/www/域名.com/conf_global.php


'sql_database' => '資料庫名稱',
'sql_user' => '資料庫用戶',
'sql_pass' => '用戶密碼',



ESC儲存並離開
:wq





刪除網站備份檔 web.zip
rm web.zip








---------------------------
將Nginx啟動
---------------------------

將Nginx啟動
/etc/init.d/nginx start






-----------------------
回到論壇
-----------------------

此時,論壇可以連入

https://域名.com/


後續從這個步驟開始做

Cron每分鐘執行論壇任務、每天自動備份DB資料庫、自動備份WWW網站檔案

建立帳號或登入後發表意見

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.