• I’m working on taking my site to a new level, and I need some expert MySQL help please. I want to copy an entire WP 2.2.2 database, and do some search-replace, and then install it as a new database (or better: a new table in the old database).

    (1) Is there a better tool than PHP-MyAdmin? This is what my host provides, web-based, and it is the only way I have ever “seen” my WP database. I know almost nothing about databases. I have heard that I should use a desktop MySQL editor, to make Search-Replace easier. Is there a desktop program for this, how about a free one?

    (2) Any tips for how to do a search-and-replace? I want this to apply to pretty-much the whole WP database, not just the post content. The database isn’t huge, it’s pretty much the default freshly installed WP. I realize search-replace can have false positives so I want to approve, next, approve, next, and so on.

    (3) Is it easy to change the table-prefix (from wp_ to wp2_, for example) and copy-paste the modified database as a new table (new blog)?

Viewing 6 replies - 1 through 6 (of 6 total)
  • what you want to do is very easy to accomplish with phpmyadmin …

    2. if you download a backup, and open it up you will notice its just a text file. Searching and replacing a text file is as simple as using the replace fucntion in wordpad.

    3. you dont even need to it in that order.. if you look inside phpmyadmin it allows you to copy 1 table over to another table (with a new table name obviously); you can even copy a table that exists within one db into another table inside another db.

    there are undoubtedly more complicated ways to do any or all of that, but they arent really necessary.

    1) There are other tools to do interaction with MySql, but it would probably depend on what sort of access you have into the server. If you’ve got an x-windows based gui shell on the same network as the mysql box for example, you could run programs on there. Otherwise the phpmyadmin thing is probably the best.

    2) Do a database export in “inserts” format through phpmyadmin or a mysqldump, then load the results into a suitably powerful editor like Vim and get replacing. It’d be a labourious process.

    3) I have thought about trying this myself. In theory you could do it as described in 2) but it seems very manual and tedious. It *may* be easier to do a customised export of the data, but that could be tricky to set up. The problem with changing the inserts is that you’d have to change every single line, because they’d all have to go into new tables. Not really a big deal, but the problem comes where there’s an occurence of wp_ that you *don’t* want to change. If that’s 1 line in 5000 lines then it’s a right pain.

    Thread Starter Dgold

    (@dgold)

    Thanks for the tips, I’m going to give it a try. Things like this can be a bit intimidating at first when you’re not sure. This is good news. I appreciate the feedback y’all.

    whoami’s way seems easier. ??

    Also just thought mysql lets you do

    CREATE table newtablename
    SELECT * FROM oldtablename

    So you could just run lots of those statements to copy old to new within the same db, then export new (if you wanted to move them to another db).

    mysql4.1 also allows

    CREATE TABLE newtablename LIKE oldtablename

    WHich makes an empty copy of oldtablename as newtablename with its indexes.

    Thread Starter Dgold

    (@dgold)

    For the record

    I know I didn’t explain what I was trying to do, in this thread… but for reasons of What i was really trying to accomplish Vs. what I asked how to do…

    in the end I am changing my approach, I am going to remake the blogs with the install.php technique described below instead of trying to do MySQL search-replace
    https://wpbits.wordpress.com/2007/08/10/automating-wordpress-customizations-the-installphp-way/

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘MySQL – PHP-MyAdmin advanced questions’ is closed to new replies.