0

I have many MySQL databases that have same tables with the same structure. I am looking for simple way how can I alter table structure in all of the databases at once ( in one query or using one tool).

2 Answers 2

2

you can see this solution like of alter many tables in the post :

select concat( 'alter table ', a.table_name, ' add index `fields` (`field`);' )
from information_schema.tables a 
where a.table_name like 'table_prefix_%';
Sign up to request clarification or add additional context in comments.

Comments

0

A QND way, but anyhow,

  • make changes on main-db with prefered tool.
  • copy successful sql-statement to web-script (php or similar) that executes the sql with loop on defined 'slave' dbs.

//regards

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.