phpmyadmin cannot open table's browse view

2019-04-09 02:04发布

问题:

I had a table open in phpmyadmin using the browse view, and entered an incorrect query. Unfortunately, I restarted my browser before correcting the view, and I cannot open browse view to correct the error. Every time I open the table, I get the following popup:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEC,x ASC,z ASC LIMIT 0,30' at line 1

Closing this popup by clicking it leaves me on the page I was already on instead of allowing me to correct the error. Please note that I have checked that the table is ok, and that I can open the table in other views and from other programs, meaning this error is an inconvenience, but will not stop me from working all together. Furthermore, no other tables are affected.

回答1:

I figured it out. Click the icon to the left of the table to open the list of columns, select all columns, and click "Browse" next to the text "with selected". Then, click the edit button in the sql code at the top of the page, and paste:

SELECT * FROM TABLE_NAME ORDER BY COLUMN_NAME DESC

This will make the default browse view for that table sort the table by COLUMN_NAME in descending order, overwriting the corrupt default sort. I'm leaving this up because I spent at least an hour searching google and the documentation for a solution with no luck whatsoever.



回答2:

The last time you used the Browse tab of this table, you entered an SQL statement which contained

DEC,x ASC,z ASC LIMIT 0,30

While this contained faulty syntax - or syntax which went faulty when you changed something else in the database - it was still saved as your preference.

I'm not sure if this can be adjusted via the UI, but your MySQL admin can go to the phpmyadmin database and delete the faulty entry in the pma__table_uiprefs table.



回答3:

Megaton Solution: Open DevTools and clear all storage (Cookies, LocalStorage, IndexedDB)