PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, January 14, 2022

[FIXED] Phpmyadmin 5.0.2 error when cloning database

 January 14, 2022     mysql, phpmyadmin, ubuntu     No comments   

Issue

I apologize in advance for my English, I have updated both mysql (5.7.30) and Phpmyadmin (5.0.2). It happens that when copying a database with a different name, the views in the clause where you are adding something like databasename.tablename, in previous versions did not someone know why this happens?

In the previous version when cloning a database (Enterprise) with a different name (NewEnterprise) the views kept their original structure, example:

CREATE VIEW customerPayments
AS 
select ID, FIRST_NAME, LAST_NAME 
from customer;

In the current version, when it is cloned, the structures change, being in the new database, the views refer to the previous example:

CREATE VIEW customerPayments
AS 
select ID, FIRST_NAME, LAST_NAME 
from Enterprise.custome

Where should something like

CREATE VIEW customerPayments
AS 
select ID, FIRST_NAME, LAST_NAME 
from NewEnterprise.custome

Or as it happened that left it without the alias of the database. I hope I have made myself understood, otherwise please let me know and I will try to expand the information


Solution

This is really a side-effect of how MySQL handles views — they are strictly defined with the database, table, and column names all needing to be explicitly referenced in the view (for instance, a view of SELECT * FROM `bar`; gets interpreted and stored as SELECT `id`, `name` FROM `foo`.`bar`;. So even though you may not have explicitly set the database name or even column names in the view, that's how MySQL stores them.

When copying a database, phpMyAdmin should do the helpful thing and ask you to adjust these; it doesn't right now. I've added a feature request at https://github.com/phpmyadmin/phpmyadmin/issues/16214 to add that functionality.



Answered By - Isaac Bennetch
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing