Sample Header Ad - 728x90

mysql ORDER BY return order differently

1 vote
1 answer
71 views
Trying to figure out why mysql's ORDER BY clause can return order differently, e.g.: enter image description here The two files are both generated by using mysql on command line with a single command: mysql mydb -e 'SELECT DISTINCT name FROM my_table ORDER BY name;' > name.lst but on two different Linux systems, querying the same DB with apparently same mysql/MariaDB:
# Machine 1
$ mysql -V
mysql  Ver 15.1 Distrib 10.5.25-MariaDB, for Linux (x86_64) using  EditLine wrapper


# Machine 2
$ mysql -V
mysql  Ver 15.1 Distrib 10.5.25-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
Where should I look next for what's causing the problem please? (Like my LANG? would it matter?) **UPDATE:** Comparing character set / collation variables completely as suggested by Akina revealed where the problem is. Here is the comparison between two systems https://www.diffchecker.com/DhsN55Wq/ enter image description here Comparing with the two and consulting with https://stackoverflow.com/questions/30074492/what-is-the-difference-between-utf8mb4-and-utf8-charsets-in-mysql , I'm thinking that settings on the right make more sense; what'd you say? How to correct it please? thx.
Asked by xpt (143 rep)
Jul 31, 2024, 10:11 PM
Last activity: Aug 7, 2024, 10:47 AM