Giter Site home page Giter Site logo

mysql-search-replace-php's Introduction

MySQL Search & Replace Tool

Find and replace a string in your entire MySQL database using this PHP script or PHP class. You can utilize it either as a class or via an HTML form.

AUTHOR INFO

WHAT DOES THIS SCRIPT DO?

This MySQL Search & Replace tool provides an easy way to search an existing MySQL database for any string and, if you wish, replace it with another string.

WHY WOULD I NEED THIS?

There are several reasons to use this tool. It's particularly handy for replacing strings when migrating MySQL databases from one server to another. This is especially helpful for large WordPress databases that are cumbersome when exported to a .sql file and opened in a text editor.

WHERE SHOULD I PUT THE SCRIPT?

To use this tool, you'll need to place it either on the server that contains the database you need to search or, if you're using it remotely, ensure you have remote access to the database.

HOW DO I USE MySQL SEARCH & REPLACE?

It's straightforward:

  1. Copy the "MySQL-Search-Replace" folder to a directory on your web server.

  2. Open a browser and navigate to the "MySQL-Search-Replace" folder. You'll find a form containing all the fields needed to search for, or search and replace, strings in your database.

  3. Fill out the form, ensuring to double-check all your entries.

  4. Click 'Start' to begin.

TIPS

Before attempting a full replace, it's a good idea to attempt a search. This way, you can see the number of times the string is found in your database before actually making changes to it.

DISCLAIMER

This is a powerful tool, so please be careful. If you use this tool, you're doing so at your own risk. Before attempting search and replace, please make sure you have a backup of your database. Ensure you understand how it works before using it on real databases.

COPYRIGHT

MySQL Search & Replace is released under the GPL (see license.txt).

Example Usage as PHP Include

// add class file
require_once 'MySQLSearchReplace.php';

// settings
$config = array(
    'server'   => 'localhost',
    'user'     => 'root',
    'password' => '',
    'db'       => 'my_db_name',
    //'action'   => 'search'
);

// search text
$search = 'http://www.oldsite.com';

// replace text
$replace = 'http://www.newsite.com';

// do now..
$tool = (new MySQLSearchReplace($config, $search, $replace))->startFindReplace();

Example Usage as HTML

MySQL Search & Replace Form

Class File (MySQLSearchReplace.php)

View Class File

mysql-search-replace-php's People

Contributors

noncent avatar schmidi2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.