我面臨奇怪的伺服器行為mysql 5.1.50 . 它錯誤地排序記錄 .
例如,我建立了乙個表 test :
create table if not exists `test` (
`id` int(11) not null auto_increment,
`title` varchar(250) not null,
primary key (`id`)
) engine=myisam default charset=utf8;
insert into `test` (`id`, `title`) values
(1, 'record1'),
(2, 'record2'),
(3, 'abcdefghijklmnopqrstuvwxyz'),
(4, 'abcdefghijklmnopqrstuvwxyy');
並進行查詢:
mysql> set names utf8;查詢正常,0行受影響(0.00秒)
mysql>按 headers asc從測試順序中選擇*;
| id | title |
| 3 | abcdefghijklmnopqrstuvwxyz |
| 4 | abcdefghijklmnopqrstuvwxyy |
| 1 | record1 |
| 2 | record2 |
4行(0.00秒)
mysql>按 headers desc從測試順序中選擇*;
| id | title |
| 2 | record2 |
| 1 | record1 |
| 3 | abcdefghijklmnopqrstuvwxyz |
| 4 | abcdefghijklmnopqrstuvwxyy |
4行(0.00秒)
如您所見,記錄3和4不會改變位置
我做了這樣的查詢,有些字母不會改變訂單,例如a和a .
mysql> select * from test order by title collate utf8_unicode_ci asc;
| id | title |
| 1 | a |
| 27 | a |
| 28 | b |
| 2 | b |
| 29 | c |
| 3 | c |
| 4 | d |
| 30 | d |
| 31 | e |
| 5 | e |
| 6 | f |
| 32 | f |
| 33 | g |
| 7 | g |
| 34 | h |
| 8 | h |
| 35 | i |
| 9 | i |
| 36 | j |
| 10 | j |
| 11 | k |
| 37 | k |
| 12 | l |
| 38 | l |
| 39 | m |
| 13 | m |
| 40 | n |
| 14 | n |
| 41 | o |
| 15 | o |
| 42 | p |
| 16 | p |
| 17 | q |
| 43 | q |
| 44 | r |
| 18 | r |
| 19 | s |
| 45 | s |
| 20 | t |
| 46 | t |
| 21 | u |
| 47 | u |
| 48 | v |
| 22 | v |
| 49 | w |
| 23 | w |
| 50 | x |
| 24 | x |
| 25 | y |
| 51 | y |
| 26 | z |
| 52 | z |
mysql> select * from test order by title collate utf8_unicode_ci desc;
| id | title |
| 52 | z |
| 26 | z |
| 25 | y |
| 51 | y |
| 50 | x |
| 24 | x |
| 49 | w |
| 23 | w |
| 48 | v |
| 22 | v |
| 47 | u |
| 21 | u |
| 20 | t |
| 46 | t |
| 45 | s |
| 19 | s |
| 18 | r |
| 44 | r |
| 17 | q |
| 43 | q |
| 16 | p |
| 42 | p |
| 41 | o |
| 15 | o |
| 40 | n |
| 14 | n |
| 39 | m |
| 13 | m |
| 12 | l |
| 38 | l |
| 11 | k |
| 37 | k |
| 10 | j |
| 36 | j |
| 9 | i |
| 35 | i |
| 8 | h |
| 34 | h |
| 7 | g |
| 33 | g |
| 32 | f |
| 6 | f |
| 5 | e |
| 31 | e |
| 4 | d |
| 30 | d |
| 29 | c |
| 3 | c |
| 2 | b |
| 28 | b |
| 1 | a |
| 27 | a |
我認為這是整理的錯誤 .
可能有人碰到這樣的伺服器行為?
mysql排序錯誤 這是MySQL排序錯誤嗎?
我面臨奇怪的伺服器行為 mysql 5.1.50.它錯誤地排序記錄.例如,我建立了乙個表測試 create table if not exists test id int 11 not null auto increment,title varchar 250 not null,primary ke...
mysql10067錯誤 如何安裝MySQL資料庫
2.解壓mysql安裝包到指定目錄,我的目錄為c mysql,並複製乙份my default.ini檔案備用。修改my default.ini檔案 basedir c mysql datadir c mysql data port 3306 注意 去掉原始檔上述三行前面的 新增環境變數 新建系統變數...
解決sqoop連線mysq錯誤
一 問題描述 1.由於當前集群沒有配置zookeeper hcatalog accumlo,因此應該在sqoop的配置檔案中注釋掉判斷zookeeper hcatalog accumlo路徑是否正確的 二 解決辦法 vim usr local sqoop bin configure sqoop 將如...