Possible to disable strict in Managed MySQL?

October 23, 2019 133 views
DigitalOcean Managed MySQL Database

I know we cannot make changes like that. However is there a way to have a managed database setup like this? It is one of the major hangups with a large codebase that we are wanting to use Managed MySQL with.

Thanks

1 Answer

Hello,

You should be able to change the sql_mode for your session. You can do that with:

  • First check your sql_mode value:
mysql> show variables like 'sql_mode';

Output:

+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Variable_name | Value                                                                                                                                                                           |
+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| sql_mode      | REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ONLY_FULL_GROUP_BY,ANSI,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION |
+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
  • Then set the sql_mode to the value that you need:
mysql> SET SESSION sql_mode = '';
Query OK, 0 rows affected (0.01 sec)
  • Then check the value again:
mysql> show variables like 'sql_mode';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| sql_mode      |       |
+---------------+-------+
1 row in set (0.00 sec)

Hope that this helps!
Regards,
Bobby

Have another answer? Share your knowledge.