How to change MySQL mode permanently in MySQL Managed Database?

How to change MySQL mode permanently in MySQL Managed Database? I know that are no way to access as root user or access to MySQL config in managed database. but please show me how or add an option that user can change mode by themeselve.


I have this question as well. Migrating from MySQL 5.7(or before) to 8 will require this option.

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I found the work around. Just simply put mode change query first when you connected to database. mean that every connection have to change mode before you do things. I know it is not good solution but it help me out for now.

Hi there, our sincere apologies for the delay in response. For Mysql managed DBaaS, you won’t be able to change the SQL mode yourself because it requires superuser privileges, and our admins are the only super users. Please open a ticket with us and we will have this taken care of for you.

Thanks, Peace

It would be nice if DO could make it tweakable so we don’t need to create a ticket for this every time we spin a new Managed DB

I came across this solution online by Nathaniel Hammond:

The implementation is swift and takes just a couple of seconds or minutes:

  1. Log into your server as root
  2. Get script wget
  3. Make is executable chmod +x
  4. Run the script ./

You can keep the script where you downloaded it for future mods or references or you can rm -rf and delete the shell script.

You will then have MySQL 5.7 without strict mode.

DISCLAIMER: Not sure if it works with version 8.0

Hi Kalin,

Unfortunately, this does not work for managed service. Any update from the Digital Ocean team regarding this would be highly appreciated. Maybe I will open the ticket with Digital Ocean and post the reply here.

Thanks, Sanjay

Hi @ardencod3,

You’ll need to edit your my.cnf file. To find where it’s stored first type

locate my.cnf

Once you’ve found it, use your preferred text editor, add the sql-mode variable and specify required SQL modes on a new line under the [mysqld] section:

vim /path/to/file/my.cnf
sql-mode = 'sql-mode-name1,sql-mode-name2'

Where sql-mode is an MYSQL MODE

One done, restart your mysql service.

Kind regards, Kalin D.