database

Replace string in big database or large text file

You have a cms and a big database with over 100 tables and 100.000 entries. And you need to replace all entries contain "example.com" with "www.example.com". How you do that? Editing all entries manually with phpmyadmin? It could takes weeks to complete. I have found a solution and want to share with you.

Steps:

1. Export your whole database in a text file : db.sql
2. Replace string using Linux sed command
3. Empty your db and import new sql file

Export your mysql database into a text file: db.sql

mysqldump -u root -p your_database_name > db.sql

Configure phpMyAdmin to login automagicly without prompted for username and password

Do you need to configure phpMyAdmin to login automagicly without prompted for username and password? I needed two hours to get it works, do not spend so much time and just follow steps below:

1. Download PhpMyAdmin

2. unzip phpmyadmin

3. create a file named "config.inc.php" with following content and replace login information with yours

<?php
/*
 * Generated configuration file
 * Generated by: phpMyAdmin 3.3.2 setup script by Piotr Przybylski 
 * Date: Thu, 29 Apr 2010 11:20:23 +0200
 */

/* Servers configuration */
$i = 0;
Syndicate content

CafeWebmaster.com(CW) is a free online community for webdevelopers and beginners. Anybody can share their code, articles, tips, tutorials, code-examples or other webdesign related material on the site. Newbies can submit their questions and reply to existing questions. CW does not guarantee or warrant reliability of code, data and information published on the site. Use the site on your own risk. The site takes no responsibility of direct or indirect loss or any kind of harm to its users. The site also doesn't take responsibility of infected files or source code with any kind of infection or viruses, worms, spywares, malwares, trojan horses. CW reserves the right to edit, move, or delete any of content for any reason.