Count tables MYSQL
Count tables within a DB, nice and easy.. use db_name; select count(*) from information_schema.tables where table_schema = database();
Read MoreGroup data in MySQL every N hours
Group data in MySQL every N hours Using the hour to aggregate.. in this example every 3 hours. select * from tbl_sometable group by floor(hour(time) / 3);
Read MoreMYSQL Dump Single Table
Dumping Single MYSQL Table mysqldump db_name table_name > table_name.sql mysqldump -u -h -p db_name table_name > table_name.sql mysqldump -u -h -p db_name table_name –events –triggers –routines > table_name.sql
Read MoreExtract Table from SQL Dump – MYSQL
Extract Table from SQL Dump – MYSQL The script below creates individual table exports from a SQL dump. ./MyDumpSplitter.sh yourfile.sql your_table_name [code] #!/bin/sh # http://kedar.nitty-witty.com #SPLIT DUMP FILE INTO INDIVIDUAL TABLE DUMPS # Text color variables txtund=$(tput sgr 0 1) # Underline txtbld=$(tput bold) # Bold txtred=$(tput setaf 1) # Red txtgrn=$(tput setaf 2) # […]
Read MoreMYSQL Event Scheduler – Auto Enable
MYSQL Event Scheduler – Auto Enable If you are finding the MYSQL event scheduler is disabled everytime you start MYSQL, use the following my.cnf or mysql.ini settings; event_scheduler=on That Simple!!
Read MoreReset MYSQL root password – Linux
Reset MYSQL root password – Linux Log on to your Linux machine as the root user. The steps involved in resetting the MySQL root password are to stop the MySQL server, restart it without the permissions active so you can log into MySQL as root without a password, set a new password, and then restart […]
Read MoreSQL Where values are not in another table
SQL Where values are not in another table [sql] select TCode from Tracking where not exists (select * from Task where Task.TCode = Tracking.TCode ) [/sql]
Read MoreMYSQL – Replication
MYSQL – Replication Login to your mysql server: mysql -uBla -p Some useful commands SHOW SLAVE STATUS; SHOW MASTER STATUS; SHOW PROCESSLIST ; SHOW SLAVE HOSTS;
Read More