Database fix collation
Submitted by
Dmitro
on
If on db import you get error "Unknown collation: 'utf8mb4_0900_ai_ci'"
sed -i '' 's/utf8mb4_0900_ai_ci/utf8mb4_general_ci/g' db.sql
If on db import you get error "Unknown collation: 'utf8mb4_0900_ai_ci'"
sed -i '' 's/utf8mb4_0900_ai_ci/utf8mb4_general_ci/g' db.sql
Update the 'pair' field using an expression to concatenate the fields.
$database = \Drupal::service('database');
$database->update('mono_currency_rates')
->expression('pair', "CONCAT(currency_code_sell, '/', currency_code_buy)")
->isNull('pair')
->execute();
Sort:
Restore database:
drush sql:drop -y && pv ~/www/SITE_NAME/web/sites/default/files/backups/last.mysql | drush sql-cli --extra=-A
Restore zipped database:
drush sql:drop -y && unzip -p ~/www/_db_backups/SITE_NAME/last.mysql.zip | pv | drush sql-cli --extra=-A
Backup database:
drush sql:dump --structure-tables-list="cache,cache_*" > new.sql