Skip to content

Ability to set the database collation and charset on creation #54

@edwardjosephbennett

Description

@edwardjosephbennett

Hi,

Is it possible to set the Database Collation and Database Charset when running wp valet new site?

I have been tinkering around with this and valet and find the setup fantastically useful, although this issue has been bugging me for a while.

At the minute when running the new site command, a database gets created with the following collation:
screenshot 2019-01-23 at 15 13 23

I have a plugin that creates database tables, which throws up errors on activation regarding and incorrect collation type. See an example of stack trace below:

Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1253 COLLATION 'utf8mb4_unicode_520_ci' is not valid for CHARACTER SET 'utf8' in .../wp-content/plugins/.../vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:77
Stack trace:
#0 .../wp-content/plugins/.../vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(77): PDO->prepare('set names 'utf8...', Array)
#1 .../wp-content/plugins/.../vendor/illuminate/database/Connectors/MySqlConnector.php(56): Doctrine\DBAL\Driver\PDOConnection->prepare('set names 'utf8...')
#2 .../wp-content/plugins/.../vendor/illuminate/database/Connectors/MySqlConnector.php(30): Illuminate\Database\Connectors\MySqlConnector->configureEncoding(Object(Doctrine\DBAL\Driver\PDOConnection), Array)

The issue I think sits around the either the plugin trying to set names 'utf8...' or the original collation being set with the 520 part is wrong.

Current MySQL Version is: Ver 8.0.13 for osx10.14 on x86_64 (Homebrew)

Any help on how this issue may be worked around either from WP-CLI Valets point of view or WP-CLI itself is appreciated.

Thanks,
Ed

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions