mysql backup shell script
mysql backup shell script#!/bin/sh# mysql_backup.sh: backup mysql databases and keep newest 5 days backup.## Last updated: 2006.9.6# ———————————————————————-# This is a free shell script under GNU GPL version# Feedback/comment/suggestions : http://www.strongd.net# ———————————————————————- # your mysql login information# db_user is mysql username# db_passwd is mysql password# db_host is mysql host# —————————–db_user=”root”db_passwd=”passwd”db_host=”localhost” # the directory for story […]
Removing HTML tags using mysql
Try this (ported from a T-SQL func by Robert Davis): SET GLOBAL log_bin_trust_function_creators=1;DROP FUNCTION IF EXISTS fnStripTags;DELIMITER |CREATE FUNCTION fnStripTags( Dirty varchar(4000) )RETURNS varchar(4000)DETERMINISTIC BEGIN DECLARE iStart, iEnd, iLength int; WHILE Locate( ‘<‘, Dirty ) > 0 And Locate( ‘>’, Dirty, Locate( ‘<‘, Dirty )) > 0 DO BEGIN SET iStart = Locate( ‘<‘, Dirty […]
Exploring Mysql CURDATE and NOW. The same but different.
Sometimes I see people attempting to use VARCHARS or CHARS to store dates in their MySQL database application. This is really fighting against MySQL, which has a variety of interchangeable date types. Internally MySQL is storing dates as numbers, which allows it to do all sorts of nice arithmetic and comparisons with very little effort […]