How to set the SQL Mode on a MySQL connection in JetBrains DataGrip
Asked Answered
E

1

5

Does JetBrains DataGrip have any way to allow me to set the SQL_MODE automatically for my connection to a MySQL database?

For example, MySQL Workbench has a specific field for the connection that would set the SQL_MODE. Whilst HeidiSQL provide a way to execute a Startup Script.

Edinburgh answered 29/6, 2017 at 12:9 Comment(0)
E
11

In DataGrip, follow these steps.

  1. Go to File > Data Sources and select your connection from the list of Project Data Source.
  2. Go to the Advanced tab which lists a lot of variables.
  3. Locate the the variable named sessionVariables. (Tip: You can search for a particular variable by selecting any variable name, then start typing to seek.)
  4. Set the value for the variable with your SQL mode. For example:

    sql_mode='STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,ONLY_FULL_GROUP_BY'
    
Edinburgh answered 29/6, 2017 at 12:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.