Archive

Archive for the ‘MySQL’ Category

cPanel access denied for user modsec at mysql localhost

January 6th, 2008 Behzad No comments

Did you get this email:

/etc/cron.hourly/modsecparse.pl:

DBI connect(‘modsec:localhost’,'modsec’,…) failed: Access denied for user ‘modsec’@'localhost’ (using password: YES) at /etc/cron.hourly/modsecparse.pl line 19
Unable to connect to mysql database at /etc/cron.hourly/modsecparse.pl line 19.

If you are using old cPanel/Apache 1.3 just goto whm -> Plugins then remove and reinstall mod_security.

If you installed Apache2 mod_security with easyapache3 on cPanel 11 and you get this error, check password at /etc/cron.hourly/modsecparse.pl and you can adjust password of modsec user through whm -> phpMyAdmin -> privileges

Search and Replace Text String in MySQL Database with phpMyAdmin

December 10th, 2007 Behzad 1 comment

ALERT!

Before runing any search and replace on a database table, take a copy of your data, or you may loose your valuable data.

To copy current table, open phpMyAdmin, and click on your database name, then click on table name you want to run the search and replace through. At the top of the window, click on the “Operations” tab. On form with title “Copy table to”, type current table name and append “_bak” to it. Click on “Go” to take a copy of the table.

To search and replace a text string, goto phpMyAdmin, and click on your database name, then click on table name that you want to run the search and replace through. At the top of the window, click on the “SQL” tab.

In the text box, enter the following code. This is the generic setup, so edit to satisfy your needs:

UPDATE tablename SET field = replace(field, “SearchString”, “ReplaceString”);

You can add a WHERE clause onto this as well.

UPDATE tablename SET field = replace(field, “SearchString”, “ReplaceString”) WHERE field2=’SomeValue’ ;

Hope this helps.