J4.x

Difference between revisions of "CLI Database Exporter Importer/zh-tw"

From Joomla! Documentation

(Created page with "== 備份及還原 ==")
(Created page with "# 匯入所有的 Joomla 資料庫:<br /><tt>php cli/joomla.php database:import --all --folder tmp/db_bak</tt> # 取出封存檔案:<br /><tt>tar --recursive-unlink -xvf t...")
 
(11 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
{{-}}
 
{{-}}
 
== 關於 ==
 
== 關於 ==
Before updating Joomla! or [[S:MyLanguage/J4.x:CLI Update|installing a third party extension]], it is strongly recommended that you back up your site.<br />
+
在升級 Joomla! 或是 [[S:MyLanguage/J4.x:CLI Update|安裝第三方擴充套件]]之前,強烈建議您備份您的網站<br />
The Joomla! 4.x Console provides commands for exporting (backing up) and importing (restoring) your Joomla! database. Note that it doesn't backup your filesystem which should be done separately
+
Joomla! 4.x Console 提供指令來匯出 (亦即備份) 以及匯入 (亦即還原) 您的 Joomla! 資料庫。請注意這並不會備份您的檔案,備份檔案要另外作業。
  
  
 
== 需求 ==
 
== 需求 ==
To use these commands, you need a secured shell access (SSH) to your host on which the PHP CLI (Command Line Interface) is installed.
+
要使用這些指令,您需要使用 (SSH) 連接到您的伺服器,而且伺服器上要有安裝 PHP CLI (Command Line Interface)
Consider to have basic knowledge of using shell commands.
+
您應該要具備一些 shell 指令基礎的知識
  
 
== 介紹 ==
 
== 介紹 ==
Log into your host and go to the root folder of your site.<br />
+
登入您的主機,到您網站的最頂層<br />
I recommend to use the Joomla 'tmp' folder in your <folder_path> to have read/write permissions.
+
我建議使用位於<folder_path>的 Joomla 'tmp' 資料夾,並確認讀寫權限。
  
* List all available commands of the Joomla Console:<br /><tt>php cli/joomla.php list</tt>
+
* 列出 Joomla Console 可以使用的所有指令:<br /><tt>php cli/joomla.php list</tt>
* Export the database to the folder:<br /><tt>php cli/joomla.php database:export --all --folder <folder_path></tt>
+
* 匯出資料庫到檔案夾:<br /><tt>php cli/joomla.php database:export --all --folder <folder_path></tt>
* Import the database from folder:<br /><tt>php cli/joomla.php database:import --all --folder <folder_path></tt>
+
* 從資料夾檔案匯入資料庫:<br /><tt>php cli/joomla.php database:import --all --folder <folder_path></tt>
  
You can also:
+
您也可以:
* Export the database as a .zip file:<br /><tt>php cli/joomla.php database:export --all --zip</tt>
+
* 匯出資料庫為 .zip 檔案:<br /><tt>php cli/joomla.php database:export --all --zip</tt>
* Export a table:<br /><tt>php cli/joomla.php database:export --table <table_name></tt>
+
* 匯出一個資料表:<br /><tt>php cli/joomla.php database:export --table <table_name></tt>
* Export a table as a .zip file:<br /><tt>php cli/joomla.php database:export --table <table_name> --zip</tt>
+
* 匯出資料庫為 .zip 檔案:<br /><tt>php cli/joomla.php database:export --table <table_name> --zip</tt>
* Import a table:<br /><tt>php cli/joomla.php database:import --table <table_name></tt>
+
* 匯入一個資料表:<br /><tt>php cli/joomla.php database:import --table <table_name></tt>
* If you need help:<br /><tt>php cli/joomla.php database:export --help</tt> <tt>php cli/joomla.php database:import --help</tt>
+
* 假如您需要:<br /><tt>php cli/joomla.php database:export --help</tt> <tt>php cli/joomla.php database:import --help</tt>
  
  
 
== 備份及還原 ==
 
== 備份及還原 ==
To make a full backup (with folders, files and database) of your site, you can execute these commands:
+
要建立網站的完整備份 (包含資料庫、檔案和資料夾) ,您可以執行這些指令:
# Archive your Joomla root directory:<br /><tt>tar --exclude='./tmp/joomla_bak.*' -zcvf tmp/joomla_bak.tgz . > tmp/joomla_bak.log</tt>
+
# 封存 Joomla 頂層路徑:<br /><tt>tar --exclude='./tmp/joomla_bak.*' -zcvf tmp/joomla_bak.tgz . > tmp/joomla_bak.log</tt>
# Export all the Joomla database:<br /><tt>php cli/joomla.php database:export --all --folder tmp/db_bak</tt>
+
# 匯出 Joomla 資料庫:<br /><tt>php cli/joomla.php database:export --all --folder tmp/db_bak</tt>
  
And to restore it, execute these commands:
+
要還原備份,請執行以下指令:
# Import all the Joomla database:<br /><tt>php cli/joomla.php database:import --all --folder tmp/db_bak</tt>
+
# 匯入所有的 Joomla 資料庫:<br /><tt>php cli/joomla.php database:import --all --folder tmp/db_bak</tt>
# Extract the archive:<br /><tt>tar --recursive-unlink -xvf tmp/joomla_bak.tgz .</tt>
+
# 取出封存檔案:<br /><tt>tar --recursive-unlink -xvf tmp/joomla_bak.tgz .</tt>
  
 
<noinclude>
 
<noinclude>

Latest revision as of 19:06, 31 January 2021

Other languages:
Deutsch • ‎English • ‎español • ‎français • ‎italiano • ‎Nederlands • ‎中文(台灣)‎
Joomla! 
4.0

關於

在升級 Joomla! 或是 安裝第三方擴充套件之前,強烈建議您備份您的網站
Joomla! 4.x Console 提供指令來匯出 (亦即備份) 以及匯入 (亦即還原) 您的 Joomla! 資料庫。請注意這並不會備份您的檔案,備份檔案要另外作業。


需求

要使用這些指令,您需要使用 (SSH) 連接到您的伺服器,而且伺服器上要有安裝 PHP CLI (Command Line Interface)。 您應該要具備一些 shell 指令基礎的知識

介紹

登入您的主機,到您網站的最頂層
我建議使用位於<folder_path>的 Joomla 'tmp' 資料夾,並確認讀寫權限。

  • 列出 Joomla Console 可以使用的所有指令:
    php cli/joomla.php list
  • 匯出資料庫到檔案夾:
    php cli/joomla.php database:export --all --folder <folder_path>
  • 從資料夾檔案匯入資料庫:
    php cli/joomla.php database:import --all --folder <folder_path>

您也可以:

  • 匯出資料庫為 .zip 檔案:
    php cli/joomla.php database:export --all --zip
  • 匯出一個資料表:
    php cli/joomla.php database:export --table <table_name>
  • 匯出資料庫為 .zip 檔案:
    php cli/joomla.php database:export --table <table_name> --zip
  • 匯入一個資料表:
    php cli/joomla.php database:import --table <table_name>
  • 假如您需要:
    php cli/joomla.php database:export --help php cli/joomla.php database:import --help


備份及還原

要建立網站的完整備份 (包含資料庫、檔案和資料夾) ,您可以執行這些指令:

  1. 封存 Joomla 頂層路徑:
    tar --exclude='./tmp/joomla_bak.*' -zcvf tmp/joomla_bak.tgz . > tmp/joomla_bak.log
  2. 匯出 Joomla 資料庫:
    php cli/joomla.php database:export --all --folder tmp/db_bak

要還原備份,請執行以下指令:

  1. 匯入所有的 Joomla 資料庫:
    php cli/joomla.php database:import --all --folder tmp/db_bak
  2. 取出封存檔案:
    tar --recursive-unlink -xvf tmp/joomla_bak.tgz .