I’m trying to change the prefix on all the tables in my site. I thought I could do this:
rename table 'wp_%' to 'wp_13_%'
But that doesn’t seem to work. I’d love input into what i may be doing wrong.
Thanks!
I’m trying to change the prefix on all the tables in my site. I thought I could do this:
rename table 'wp_%' to 'wp_13_%'
But that doesn’t seem to work. I’d love input into what i may be doing wrong.
Thanks!
You must be logged in to post a comment.
Since mysql doesn’t use wildcards like % in rename table why don’t you export the database do a global seach in your favorite text editor wp_ and replace with wp_13_?
Then you can reimport it.
That should do it.
I know you’re using MySQL, though I have something like that written for SQL Server (using T-SQL.) It’s like using a bulldozer to open a door, but it works. You could possibly use it as a basis for a MySQL query… definitely not an instantly usable answer, but something that you could base the logic for a stored procedure off if you wanted.
mysql rename syntax doesn’t support wildcards like the % you used.
You can still rename several tables in one command.
e.g. if you have table wp_A, wp_B you can rename to wp_13_A, wp_13_B
You can generate the neccesary DDL code with sql. Not pretty, but powerful 🙂
Just copy&paste the result.