Post

DDev Cheatsheat

Start a new project

cd into your project root directory. Then run the ddev config command and choose your project settings.

1
ddev config

Start an existing project

1
ddev start

Import db

1
ddev import-db --file=./file.sql

Export db

1
ddev export-db

Migrate to mysql:8.0 database

Convert your DDev Database to MySQL -

Troubleshoot

ERROR 1273 (HY000) at line 1223: Unknown collation: utf8mb4_0900_ai_ci

The error ERROR 1273 (HY000): Unknown collation: utf8mb4_0900_ai_ci indicates that the collation utf8mb4_0900_ai_ci is not recognized by your MySQL server. This collation is specific to MySQL 8.0 and later versions. If you’re running an older version of MySQL, such as MySQL 5.7 or earlier, it won’t support this collation.

Convert mysql:8.0 to mariadb

Before import search and replace dump file utf8mb4_0900_ai_ci to utf8mb4_general_ci

1
%s/utf8mb4_0900_ai_ci/utf8mb4_general_ci/g
1
ddev debug migrate-database mysql:8.0
1
ddev debug migrate-database mariadb:10.11

Upgrade DDev

1
curl -fsSL https://ddev.com/install.sh | bash

Check version

1
ddev --version

Integration with platform sh

https://ddev.readthedocs.io/en/stable/users/providers/platform/

1
ddev get ddev/ddev-platformsh

Setup DDev in existing WordPress Project

  • Comment out existing db settings in wp-config.php
  • Add to the below php to wp-config
1
2
3
4
$ddev_settings = dirname(__FILE__) . '/wp-config-ddev.php';
if (is_readable($ddev_settings) && !defined('DB_USER')) {
  require_once($ddev_settings);
}

Set custom Database Prefix

If your database uses a custom db prefix, set it in the wp-config.php file. Otherwise your site will load the install page even though you already have an wp install with ddev. Perform updates in the wp-config-ddev.php file

1
$table_prefix = 'custom_prefix_';

Remove Ddev project

1
ddev clean <project>

Delete ddev project

1
ddev delete <project>.

Connect DDev to your remote server

via ssh

1
ddev auth ssh -f ~/.ssh/id_rsa

Now you can run commands on your remote server

1
ddev drush @develop en webform

sync database from remote to local

First drop the local database

1
ddev drush sql:drop -y

Sync remote db with local

1
ddev drush sql:sync @develop @self --create-db -y

run npm inside ddev

install packages

1
ddev exec npm i

run npm command

1
ddev npm run dev
This post is licensed under CC BY 4.0 by the author.