Bobcares

Drupal Drush Import Database: How to?

by | Jun 10, 2023

Let us learn how to do the drupal drush import database with the support of our Drupal support services at Bobcares.

drupal drush import database?

Consider that we have Drush set for the source version of the application; we can synchronize them using drush.

Use the drush sql:sync command to import a single website’s database from a drush alias source, substituting [source] and [target] with the Drush aliases for the source and target databases.

Due to the fact that Drush 9 and later no longer allow two remote targets, you must configure one Drush alias to be local by issuing the command from either application.

drupal drush import database

After the import is finished, use the drush @[target] cr command to rebuild caches.

Dump and restore databases

To import a database using command-line tools, follow these steps:

  1. Firstly we have to create a dump file of the database.
  2. After that, in the new database, import the dump file.
  3. Configure database connections.

Creating a database dump file

To export the data contained in the website’s database, use the command line to produce a database dump file by executing Drush or mysqldump from the Drupal directory.

A dump from aliases wont generate reliably in Drush 9 and later because it ignores output redirection.

Instead, we must navigate to the Drupal source directory and execute the following command:

drupal drush import database

Drush saves the mysite.sql.gz site archive file relative to the current Drupal docroot.

If needed, move the file to a location that has access to the target environment.

When the command returns error messages, ensure Drush has the required permissions to save files in the docroot directory.

If we are not sourcing from the default site, we must provide a matching URI for Drush to choose the relevant site database.

drupal drush import database

Finally, import the database dump file created from the existing database into the new database when we create it.

Importing the database dump file

Follow the steps given below for importing a database dump file into a Cloud Platform subscription:

  • Firstly we have to use the SSH to connect to the Cloud Platform.
  • After that, upload the database backup to Cloud Platform with instructions similar to those shown in the Downloading backups with command line tools section.

    Change the command to upload from the local computer to Cloud Platform.

  • Import the database dump file using one of the techniques listed below:

    A: Use the drush sql:cli command to import a database dump file to the default site, substituting [target] with the Drush alias for the target site:

    drupal drush import database

    B: If we’re not using the default site, we’ll need to supply URI as a CLI option or via a custom Drush alias:

    drupal drush import database

    We may now use Secure File Transfer Protocol (SFTP), Secure Copy (SCP), or rsync to import files.

Variable legend

The values of the variables used in the preceding commands are listed in the legend below.

  • [site]: The name of the Cloud Platform application.
  • [env]: The environment into which the database will be imported. Dev (Development), test (Staging), and prod (Production) are acceptable options.
  • [db_name]: The database’s name. For the environment, use the database name from the Databases page rather than an environment-specific name.

    For example, if the sitename is an example, the default database name is likely to be example, and we should use it instead of an environment-specific name (such as exampledev or exampletest).

[Need assistance with similar queries? We are here to help]

Conclusion

To sum up we have now seen how to do the drupal drush import database with the support of our tech support team.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF