How to fix Unknown collation utf8mb4_unicode_520_ci error while importing data from an sql dump

Error:

ERROR 1273 (HY000) at line 849: Unknown collation: ‘utf8mb4_unicode_520_ci’

To fix simply replace utf8mb4_unicode_520_ci to utf8mb4_unicode_ci inside your SQL dump

Example:

sed -i 's/utf8mb4_unicode_520_ci/utf8mb4_unicode_ci/g' yoursqldumphere.sql

or

replace 'utf8mb4_unicode_520_ci' 'utf8mb4_unicode_ci' -- yoursqldumphere.sql
Read the rest

How to change WordPress main URL to new one

Using WP-CLI (preferred):

Enter folder where your WordPress is installed:

[email protected] [~]# cd ~/public_html

Create backup of your database:

[email protected] [~/public_html]# wp db export

The following command won’t do any change because of –dry-run key specified but show you tables and amount of replacement

[email protected] [~/public_html]# wp search-replace 'OLDdomain.com'
Read the rest