简体   繁体   中英

Sort rows according to “primary key” and “auto_increment” column in phpmyadmin

I want that phpmyadmin returned ascended sorted rows, according to column, with has primary key and auto_increment (for example id ).

somethimes My phpmyadmin returns disordered rows. there is some option for sorting rows? This is just more readable.

By default, phpMyAdmin does not perform any kind of sort, and just shows the rows as they are stored in the database. Sometimes rows get inserted "out of order", but you can fix this:

  • navigate to the table in question
  • click 'operations'
  • at the top left, under "Alter table order by", select your key and your order, and click 'go'

This is an ongoing maintenance thing that you will need to do from time to time, but it should solve your issue for the most part.

In phpMyAdmin 4.5.0, maybe in earlier versions too, you can set the $cfg['TablePrimaryKeyOrder'] config like so:

$cfg['TablePrimaryKeyOrder'] = 'DESC'

This defines the default sort order for the tables, having a primary key, when there is no sort order defines externally. Acceptable values : ['NONE', 'ASC', 'DESC']

This sets the default sort if the table has a primary key and that no other sort has been applied to it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM