Home |  MySQL Buzz |  FAQ |  Feeds |  Submit your blog feed |  Feedback |  Archive |  Aggregate feed RSS 2.0 English Deutsch Español Français Italiano 日本語 Русский Português 中文
Showing entries 1 to 6

Displaying posts with tag: pager (reset)

Removing all databases from a MySQL instance
+1 Vote Up -1Vote Down

Many out there will have different ideas about this, some using procs, some using a function, others using a shell script. Well I didn’t want to spend much time on it so decided a group_concat(concat would be enough.
There is no genius, rather laziness :) but what if you have a hundred databases and you want to drop them all?

mysql Thu Mar  3 13:50:06 2011 > pager sed 's/,/ /g'
PAGER set to 'sed 's/,/ /g''
mysql Thu Mar  3 13:50:32 2011 > select group_concat(concat('drop database ',SCHEMA_NAME,';')) from information_schema.schemata where SCHEMA_NAME !='mysql' and SCHEMA_NAME !='information_schema';
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| group_concat(concat('drop database '


  [Read more...]
Show warnings with MANY MANY warnings
+3 Vote Up -0Vote Down

What to do when you have too many warnings and would like to check them out.

Say you were trying to run a query which returned a heap of warnings and you want to go through the list ….

mysql> load data infile '/aaa/bbb/ccc' into table xyz LINES TERMINATED BY '\r\n';
Query OK, 0 rows affected, 65535 warnings (4 min 25.12 sec)

mysql> show warnings;
+---------+------+------------------------------------------------+
| Level   | Code | Message                                        |
+---------+------+------------------------------------------------+
| Warning | 1366 | Incorrect value: '' for column 'xx' at row 1   |
...
| Warning | 1366 | Incorrect value: '' for column 'xx' at row 9   |
| Warning | 1366 | Incorrect value: ''







  [Read more...]
pager md5sum - the quick way to compare results
+1 Vote Up -1Vote Down
I had a QA boffin email me with a question around the validity of data for a specific row in a development slave. Heres how I checked for him.

I set the pager output to md5sum. Heres an example:

Slave:
mysql> pager md5sum -
PAGER set to 'md5sum -'
mysql> select * from Residential where PropertyNumber = 106360678\G
0b07947002b59de27b6979fdcb57905a -
1 row in set (0.00 sec)


Master:
mysql> pager md5sum -
PAGER set to 'md5sum -'
mysql> select * from Residential where PropertyNumber = 106360678\G
1c6ac79d3fb2fd994ceb97406e9f2b1a -
1 row in set (0.00 sec)



Now onto why the slave is out of sync....
When MySQL splashes back too much
Employee +0 Vote Up -0Vote Down

Sometimes MySQL is too helpful. Recently I was helping a very large man working on a very small laptop that had an overly sensitive mouse. Trying to scroll back and forth to examine the system variables with the mysql command-line client was very painful. It reminded me of the Atlantic Bottlenose Dolphin named Kai at the Texas State Aquarium pictured here that was too helpful when I tried to get him to splash 'just a little' for a picture. In this case the server was returning too much to see and the very large man in frustration handed his computer to me.


mysql> pager more
PAGER set to 'more'




  [Read more...]
MySQL command line pager & mysmartpager
+0 Vote Up -0Vote Down
Few days back, Baron re-introduced MySQL's command line pager command and described some cool tricks with maatkit's mk-visual-explain (one of my favorite tools). Soon after reading it, I wished if it was possible to describe regex based (on query) paging. I have written a small hack, christened mysmartpager, that can actually do regex based paging for you. The idea is simple, write a relay that will redirect the output based on to the desired pager. The problem was complex, there was no direct way of getting to know the original query. There are a couple of indirect ways of doing so, but of course with hurdles:
  • Run mysql client with --xml option: This will print the output of each command in xml and the command itself is included in the xml. The downside
  [Read more...]
SELECT vs select
+0 Vote Up -0Vote Down

I spent way too much time this weekend trying to get the pager stuff in Drupal working for a module I`m playing with.

I had learned a lot from the watchdog module on how paging was supposed to be working and I was trying to do the same with another database. As I got a page limited by the number of records I wanted but I couldn't find any of the fancy next, previous and page number thingies that I wanted.

The watchdog module worked for me and I started stripping the watchdog module till I could actually replace my function with watchdog_overview function. Even replaced the watchdog query with my qeury.. but not such luck.. I couldn't get $output .= theme('pager', NULL, 50, 0); to work.

So as every open source geek does.. I started looking into the code. pager.inc
The header told me

  [Read more...]
Showing entries 1 to 6

Planet MySQL © 1995, 2014, Oracle Corporation and/or its affiliates   Legal Policies | Your Privacy Rights | Terms of Use

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.