How to Upgrade Magento 2 via Command Line
Vinh Jacker | 03-17-2025
In this tutorial, we will talk about Setup Upgrade Command Line setup:upgrade
in Command Line Series. As you know, from Magento 2 (Adobe Commerce), they add many commands in bin/magento
. This may difficult to get approach this, let me explain more detail about Setup Upgrade Command Line.
Setup Upgrade Command Line via command line
Go to Magento admin root folder and show usages:
php bin/magento setup:upgrade -h
Output:
Usage:
setup:upgrade [options]
Options:
--keep-generated Prevents generated files from being deleted.
We discourage using this option except when deploying to production.
Consult your system integrator or administrator for more information.
--magento-init-params=MAGENTO-INIT-PARAMS Add to any command to customize Magento initialization parameters
For example: "MAGE_MODE=developer&MAGE_DIRS[base][path]=/var/www/example.c
m&MAGE_DIRS[cache][path]=/var/tmp/cache"
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbos
output and 3 for debug
Help:
Upgrades the Magento application, DB data, and schema
To prevents generated files from being deleted, you should add the parameter --keep-generated
:
php bin/magento setup:upgrade --keep-generated
Syntax
Simple run the following command line to upgrade your store when install / update an extension in magento 2
php bin/magento setup:upgrade
Output:
Cache cleared successfully
File system cleanup:
./generated/code/Composer
./generated/code/Magento
./generated/code/Symfony
The directory './generated/metadata/' doesn't exist - skipping cleanup
./pub/static/adminhtml
./pub/static/deployed_version.txt
./pub/static/frontend
./var/view_preprocessed/pub
Updating modules:
Schema creation/updates:
Module 'Magento_Store':
Module 'Magento_Directory':
Module 'Magento_Eav':
Module 'Magento_Backend':
Module 'Magento_Theme':
Module 'Magento_Customer':
Module 'Magento_AdminNotification':
Module 'Magento_Indexer':
Module 'Magento_AdvancedPricingImportExport':
Module 'Magento_Config':
Module 'Magento_Authorization':
Module 'Magento_Cms':
Module 'Magento_Rule':
Module 'Magento_Backup':
Module 'Magento_Catalog':
Module 'Magento_Bundle':
Module 'Magento_BundleImportExport':
Module 'Magento_Search':
Module 'Magento_CacheInvalidate':
Module 'Magento_Quote':
Module 'Magento_SalesSequence':
Module 'Magento_Security':
Module 'Magento_CatalogImportExport':
Module 'Magento_Payment':
Module 'Magento_Cron':
Module 'Magento_Msrp':
Module 'Magento_CatalogInventory':
Module 'Magento_UrlRewrite':
Module 'Magento_Sales':
Module 'Magento_CatalogUrlRewrite':
Module 'Magento_Widget':
Module 'Magento_Checkout':
Module 'Magento_CheckoutAgreements':
Module 'Magento_Vault':
Module 'Magento_Downloadable':
Module 'Magento_CmsUrlRewrite':
Module 'Magento_User':
Module 'Magento_ConfigurableImportExport':
Module 'Magento_CatalogSearch':
Module 'Magento_ConfigurableProduct':
Module 'Magento_Tax':
Module 'Magento_Contact':
Module 'Magento_Cookie':
Module 'Magento_Email':
Module 'Magento_CurrencySymbol':
Module 'Magento_Paypal':
Module 'Magento_Integration':
Module 'Magento_CustomerImportExport':
Module 'Magento_SampleData':
Module 'Magento_Deploy':
Module 'Magento_Developer':
Module 'Magento_Dhl':
Module 'Amazon_Core':
Module 'Magento_CatalogRule':
Module 'Magento_ImportExport':
Module 'Magento_Weee':
Module 'Magento_Authorizenet':
Module 'Magento_Newsletter':
Module 'Magento_EncryptionKey':
Module 'Magento_Fedex':
Module 'Magento_GiftMessage':
Module 'Magento_GoogleAdwords':
Module 'Magento_GoogleAnalytics':
Module 'Magento_Ui':
Module 'Magento_GroupedImportExport':
Module 'Magento_GroupedProduct':
Module 'Magento_CatalogSampleData':
Module 'Magento_DownloadableImportExport':
Module 'Magento_Braintree':
Module 'Magento_InstantPurchase':
Module 'Magento_Analytics':
Module 'Magento_LayeredNavigation':
Module 'Magento_Marketplace':
Module 'Magento_MediaStorage':
Module 'Magento_CatalogRuleConfigurable':
Module 'Magento_MsrpSampleData':
Module 'Magento_Multishipping':
Module 'Magento_NewRelicReporting':
Module 'Magento_ProductAlert':
Module 'Magento_OfflinePayments':
Module 'Magento_SalesRule':
Module 'Magento_OfflineShipping':
Module 'Magento_PageCache':
Module 'Magento_Captcha':
.....
Nothing to import.
Please re-run Magento compile command. Use the command "setup:di:compile"
Related Post: