Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento change database table prefix

Tags:

php

mysql

magento

I accidentally have an Magento installation without an underscore for the table prefix. Is there an option to change this automatically? I don't like to alter 337 tables by hand :-)

I tried this solution but that doesn't seem to work.

Michael

like image 526
Michael Avatar asked Nov 04 '22 04:11

Michael


1 Answers

You can create the sql to rename all tables with this select:

SELECT 'rename table '||table_name||' to '||'newprefix'||table_name||';'
FROM information_schema.tables
like image 53
Tobias Avatar answered Nov 09 '22 12:11

Tobias