Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-4497

Client character set ignored by the mysql client utility

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Not a Bug
    • Affects Version/s: 5.3.12
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      Ms Windows XP (sp3)

      Description

      I use MariaDB 5.3.12 at work (Windows XP sp3) and the my.ini file contains:

      [mysql]
      default-character-set=utf8
      character-set-server=utf8
      
      [client]
      port=3306
      default-character-set=utf8
      character-set-server=utf8
      
      [client-server]
      #default-character-set=utf8
      character-set-server=utf8
      
      [client-mariadb]
      default-character-set=utf8
      character-set-server=utf8
      
      [mysqld]
      datadir=C:/webserver/MariaDB/data
      port=3306
      
      sql_mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"
      default_storage_engine=innodb
      character-set-server=utf8
      
      innodb_additional_mem_pool_size=12M
      innodb_buffer_pool_size=128M
      innodb_data_file_path=ibdata1:10M:autoextend:max:300M
      innodb_flush_log_at_trx_commit=2
      innodb_file_format=barracuda
      innodb_strict_mode=1
      innodb_file_per_table=1
      innodb_log_file_size=64M
      
      key_buffer_size=32M
      max_allowed_packet = 16M
      max_connections=30
      
      query_cache_size=16M
      
      read_buffer_size=1M
      read_rnd_buffer_size=2M
      
      skip-federated
      skip-archive
      
      sort_buffer_size=1536K
      thread_cache_size=20
      tmp_table_size=64M
      max_heap_table_size=64M
      table_open_cache=2048
      open_files_limit=4096
      slow_query_log=1
      slow_query_log_file=slow.log
      log_queries_not_using_indexes=1
      log_slow_time=2.0
      general_log=0
      lower_case_table_names=2
      

      When invoking the mysql client utility, the character settings is ignored and I get:

      MariaDB [(none)]> \s
      --------------
      mysql  Ver 15.1 Distrib 5.3.12-MariaDB, for Win32 (ia32)
      
      Connection id:          7
      Current database:
      Current user:           root@localhost
      SSL:                    Not in use
      Using delimiter:        ;
      Server:                 MariaDB
      Server version:         5.3.12-MariaDB-log mariadb.org binary distribution
      Protocol version:       10
      Connection:             localhost via TCP/IP
      Server characterset:    utf8
      Db     characterset:    utf8
      Client characterset:    latin1
      Conn.  characterset:    latin1
      TCP port:               3306
      Uptime:                 14 hours 32 min 1 sec
      

      Of course, if I invoke the mysql utility with the --default-character-set=utf8 option, it works fine, but it's a bit annoying to always type it.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            elenst Elena Stepanova added a comment -

            Hi,

            I think your client does not read the config file at all. Otherwise it wouldn't even start, because character-set-server is a server-only option, unknown for the client.

            Show
            elenst Elena Stepanova added a comment - Hi, I think your client does not read the config file at all. Otherwise it wouldn't even start, because character-set-server is a server-only option, unknown for the client.
            Hide
            elenst Elena Stepanova added a comment - - edited

            To find out where the client looks for configuration files, you can issue mysql --help command and search for
            "Default options are read from the following files in the given order:"

            Next line will contain the list of locations.

            Show
            elenst Elena Stepanova added a comment - - edited To find out where the client looks for configuration files, you can issue mysql --help command and search for "Default options are read from the following files in the given order:" Next line will contain the list of locations.
            Hide
            lourdas_v Vasilis Lourdas added a comment -

            Hi Elena,

            You are absolutely right! I copied my.ini from c:\webserver\MariaDB\data\my.ini and after deleting a few character-set-server options not recognized by the mysql utility, it worked!

            I expected the mysql client utility would read the ini from the data directory (which is where the mariadb service expects to find my.ini to start the database server), but I guess it does not.

            Damn, this is why I like MariaDB much more than MySQL. I had my issue resolved in a couple of minutes. Thank you guys, you rock! Feel free to close this bug.

            Best regards,
            Vasilis

            Show
            lourdas_v Vasilis Lourdas added a comment - Hi Elena, You are absolutely right! I copied my.ini from c:\webserver\MariaDB\data\my.ini and after deleting a few character-set-server options not recognized by the mysql utility, it worked! I expected the mysql client utility would read the ini from the data directory (which is where the mariadb service expects to find my.ini to start the database server), but I guess it does not. Damn, this is why I like MariaDB much more than MySQL. I had my issue resolved in a couple of minutes. Thank you guys, you rock! Feel free to close this bug. Best regards, Vasilis
            Hide
            elenst Elena Stepanova added a comment -

            Glad it worked for you, closing as suggested.

            In regard to the datadir – I don't think the client is even theoretically capable of finding a config file there, on the simple reason that it's unaware of the datadir at all – it's a server's property, and it's configurable, so cannot be hard-coded in the client or calculated relatively to the basedir.

            Show
            elenst Elena Stepanova added a comment - Glad it worked for you, closing as suggested. In regard to the datadir – I don't think the client is even theoretically capable of finding a config file there, on the simple reason that it's unaware of the datadir at all – it's a server's property, and it's configurable, so cannot be hard-coded in the client or calculated relatively to the basedir.
            Hide
            wlad Vladislav Vaintroub added a comment -

            "don't think the client is even theoretically capable of finding a config file there"

            There is a little known fact , or perhaps unknown to anyone except MSI installer author MSI installation creates command prompt shortcut (start=>all programs=>MariaDB x.y=>Command Prompt(MariaDB x.y)). When started , not only PATH variable is set so it includes "bin" directory, but also MYSQL_HOME variable is set to datadir, so that client can find my.ini file.

            Show
            wlad Vladislav Vaintroub added a comment - "don't think the client is even theoretically capable of finding a config file there" There is a little known fact , or perhaps unknown to anyone except MSI installer author MSI installation creates command prompt shortcut (start=>all programs=>MariaDB x.y=>Command Prompt(MariaDB x.y)). When started , not only PATH variable is set so it includes "bin" directory, but also MYSQL_HOME variable is set to datadir, so that client can find my.ini file.
            Hide
            elenst Elena Stepanova added a comment -

            Indeed, good to know
            And one doesn't even have to use the special command prompt, just set MYSQL_HOME in the environment to get it work.

            Show
            elenst Elena Stepanova added a comment - Indeed, good to know And one doesn't even have to use the special command prompt, just set MYSQL_HOME in the environment to get it work.

              People

              • Assignee:
                Unassigned
                Reporter:
                lourdas_v Vasilis Lourdas
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: