I'm having an issue where a client program needs to use a View, but it needs the results as latin1. Here's what I've got:
mysql> show global variables like 'character_set%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
mysql> Select CHARACTER_SET_CLIENT, COLLATION_CONNECTION FROM information_schema.VIEWS v;
+----------------------+----------------------+
| CHARACTER_SET_CLIENT | COLLATION_CONNECTION |
+----------------------+----------------------+
| utf8 | utf8_general_ci |
+----------------------+----------------------+
Try running the following commands:
SET character_set_client = latin1;
SET character_set_results = latin1;
SET character_set_connection = latin1;
DROP VIEW your_view;
CREATE VIEW your_view as (
here_goes_your_view_query);
Basically we're recreating the view. I've tested it locally and it worked, even after setting the DB, the table and the column to default to utf8
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With