Search code examples
mysqllocalemy.cnf

Can i change the locale oon MySQL Source-Configuration Options


I've been working on MySQL recently, and I'm changing the default settings to my convenience. I change the locale from 'en_US' to 'es_PA' because this is where I live, and I want to check the time format that way.

The thing is that normally, every time I turn on my Rpi and enter the MySQL server, the locale is at 'en_US'. so I enter the super user and do this:

set global lc_time_names = 'es_PA';

So that changes everyone's locale. But whenever I disconnect from the server, and turn off the Rpi, the locale changes back to 'en_US'.

So, my questions are two:

  1. Am I changing the locale right?
  2. Is there a way i can change it by default on the my.cnf like I did with the UTF8 (character-set)?

Thanks.


Solution

  • You can specify all long options to MySQL as a .my.cnf setting. There is an --init-command option, which you can use to always execute when connecting. So, if you set the variable in that command, you're good to go.

    Something like this should work:

    [mysql]
    init_command="SET lc_time_names='es_PA';"