Skip navigation links

User Comments

Posted by John Bercik on April 29 2009 6:27pm[Delete] [Edit]

Just a comment on the comments; It does not appear that you can add comments to Views in MySQL.

Posted by Andre K. on May 25 2009 1:56pm[Delete] [Edit]

It took me about half an hour to figure out that the semicolon problem isn't fixed in 4.0.13 (as stated in the manual) and at least exists up to 4.1.13.

This throws an "Error 1064":
/*50000 DROP FUNCTION IF EXISTS `foo`; */

But this works as expected (please note the positioning of the semicolon outside the comment):
/*50000 DROP FUNCTION IF EXISTS `foo` */;

(Tested with 4.1.13-max-log and mysql in batch mode)

Posted by Balaji Devarajan on December 9 2009 8:43pm[Delete] [Edit]

We have sql queries in 1000 places in our bash scripts and it was becoming challenging for me to figure out in the processlist to know which script is running the query. So wanted to come with some simple logic to show the script name as comments for each query in the processlist,

we have the connection string in our config file...it would be easy to change in one place instead changing at all the places in our script.

our project.config
MYSQL1="mysql -h $host -u$dbUser -p$dbPass -A $db"
function visible() {
read sql
case "$1" in
'MYSQL1')
MYSQL=$MYSQL1
;;
'MYSQL2')
MYSQL=$MYSQL2
;;
*)
exit 1
;;
esac

echo "$sql" | sed 's/^/\/* '`basename $0`' *\/ /g' | $MYSQL -c
}

MYSQL='visible MYSQL1'



the script(query_visible_test.sh) will still use what they are using.(something like this)
echo "select DISTINCT ID,count(1) CNT from STATS where HIT_DATE between '2009-11-01' and '2009-12-09' group by ID order by CNT desc limit 100;" | $MYSQL

now you will the script name in the processlist

| 987932 | user      | host:55111 | m6_agg  | Query   |       5 | Sorting for group                | /* query_visible_test.sh */ select DISTINCT ID,count(1) CNT from STATS where HIT_DATE between

Now I can go check the script or kill process if need...when the query gets locked or locking replication...etc.