140

I need to simply edit a very complicated view in phpMyAdmin 3.2.4 but I cannot figure how to do that. Any suggestions? Thanks!

5 Answers 5

232

To expand one what CheeseConQueso is saying, here are the entire steps to update a view using PHPMyAdmin:

  1. Run the following query: SHOW CREATE VIEW your_view_name
  2. Expand the options and choose Full Texts
  3. Press Go
  4. Copy entire contents of the Create View column.
  5. Make changes to the query in the editor of your choice
  6. Run the query directly (without the CREATE VIEW... syntax) to make sure it runs as you expect it to.
  7. Once you're satisfied, click on your view in the list on the left to browse its data and then scroll all the way to the bottom where you'll see a CREATE VIEW link. Click that.
  8. Place a check in the OR REPLACE field.
  9. In the VIEW name put the name of the view you are going to update.
  10. In the AS field put the contents of the query that you ran while testing (without the CREATE VIEW... syntax).
  11. Press Go

Special thanks to CheesConQueso for their insightful answer.

1
  • Who so ever looking at this answer, please update the phpMyAdmin to version 4.9.0.1, it includes the bug fix for that edit view thing.
    – Hitesh
    Commented Aug 30, 2019 at 10:56
65

In your database table list it should show View in Type column. To edit View:

  1. Click on your View in table list
  2. Click on Structure tab
  3. Click on Edit View under Check All

enter image description here

Hope this help

update: in PHPMyAdmin 4.x, it doesn't show View in Type, but you can still recognize it:

  1. In Row column: It had zero Row
  2. In Action column: It had greyed empty button

Of course it may be just an empty table, but when you open the structure, you will know whether it's a table or a view.

3
  • 1
    When I do this, I can't "edit" the view, but only replace it with a "new" view, starting from scratch.
    – user43326
    Commented May 12, 2019 at 9:28
  • Same here, getting a window with "new" view. Not seeing any SQL-code.
    – Floris
    Commented Sep 5, 2019 at 14:12
  • Don't have "Edit View" in my version, which was confusing...
    – BillyT2
    Commented Nov 9, 2021 at 23:07
47

try running SHOW CREATE VIEW my_view_name in the sql portion of phpmyadmin and you will have a better idea of what is inside the view

1
  • 4
    maybe you could create a new view based upon the result of the command above and add your edits to it? Commented Nov 11, 2010 at 16:47
12

Just export you view and you will have all SQL need to make some change on it.

Just need to add your change in SQL query for the view and change :

CREATE for CREATE OR REPLACE

0

Select your view in Bookmarked SQL query section then select Delete then click Go button.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.