Archiv der Kategorie: MySQL
Mysql here document
#!/bin/bash ##sdohn# trigger script after importing the database from our production site## USER=secret01 PASS=********** DB=mysql SERVER=192.168.17.19 mysql -u$USER -p$PASS -h$SERVER $DB -t<<eof show databases; update WPRS.wp_options set option_value='http://192.168.17.20' where option_name ='siteurl'; update WPRS.wp_options set option_value='sdohn.com' where option_name ='blogname'; update WPRS.wp_options … Weiterlesen
Howto check and repair MySQL tables
mysqlcheck -u root -p -c -A # check MySQL tables mysqlcheck -u root -p -r -A # repair MySQL tables
Export MySQL data into csv file
SELECT cal_date,cal_name,cal_description INTO OUTFILE '/tmp/export.csv' FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '"' from webcalendar.webcal_entry where cal_create_by='sdohn' AND cal_date between '20090330' AND '20090331';
Pagination in mysql CLI
Pagination in mysql CLI Ever wonder how to scroll upwards in mysl resultset ? What if your terminal doesn’t allow scrollback or the scrollback buffer is somehow set to sreen lines ? How to use MORE or LESS unix commands in mysql … Weiterlesen