How to change the root URL (move Magento 2 to another domain)?

Magento 2.0 similar to Magento 1.x stores shop root URL in the core_config_data database table.
The record paths are same: web/unsecure/base_url и web/secure/base_url.

So you can change root URL by SQL query:

UPDATE core_config_data 
SET value = 'http://example.ru/' 
WHERE path IN ('web/secure/base_url', 'web/unsecure/base_url');

It is sufficient for Magento 1.x but not for Magento 2.0.
Magento 2.0 for some strange purpose additionally stores root URL in the third path: design/head/includes

The record looks like:

<link  rel="stylesheet" type="text/css"  media="all" href="<root URL>/pub/media/styles.css" />

So you need one more SQL query:

UPDATE core_config_data
SET value = REPLACE(value, '<old root URL or domain>', '<new root URL or domain>')
WHERE path = 'design/head/includes';

For example:

UPDATE core_config_data
SET value = REPLACE(value, 'http://old.com/', 'http://new.com/')
WHERE path = 'design/head/includes';

Then delete the cache:

rm -rf var/cache/*

See also:

But then the admin url bouced to a 404 page under my domain. I don’t know why. Could you help me?

Of course. You can buy my installation service here: Magento 2 installation service

@dmitry_fedyuk
Actually, regarding the second query, I would like to add that this one is no different than in the first Magento version.

Magento 2
This field is actually the custom Scripts and Style Sheets that can be found at the following location inside Magento 2 backend:

ContentDesignConfiguration → [ScopeAction: Edit] → HTML HeadScripts and Style Sheets

Magento
The location as been changed since Magento first of its name where it was located under:

SystemConfigurationGeneralDesignHTML HeadMiscellaneous Scripts

Official Magento Doc Reference.

Of course, it is a good idea to update it with the new path as some custom script/css tags with hardcoded urls in the header could be affected. The suggested query should take this in charge very well in most cases. One might also take a look at it manually as this is a custom field and the url may not be formatted exactly the same (i.e. http / https). It might even be better to use relative urls for head tags pointing to the actual website, this way there will be no need to bother about moving the site to a different domain.