This is an old revision of the document!
You can use any of the following command to determine table type.
SHOW TABLE STATUS WHERE Name = 'table_name'; OR SHOW CREATE TABLE 'table_name'; OR SHOW TABLE STATUS;
cat slaves | while READ i ; do echo $i; mysql -h$i -e "SHOW SLAVE STATUS \G" | grep "Relay_Master_Log_File"; done
NOTE : Make sure you run the query manually on slave if it is query issue.
STOP SLAVE; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE;
This issue is appeared due to the default character set.
As Both version of database diff. character set. To get rid of that character try to following steps.
1. insert following line to your my.cnf set-variable=character-set-server=UTF8 2. re-import database should fix the issue.
By default mysqldump only store triggers not procedures/functions.
In order to include to your mysqldump there is switch
-R, –routines Dump stored routines (functions and procedures).
In order to include triggers to your mysqldump there is switch
–triggers Dump triggers for each dumped table
mysqldump -R -u <username> -p<password> <database>
Use following line in your my.cnf will resolve the issue. as latin1 is default character set in 4.0 and 4.1 has utf8
It log each and every query.
You can enable it in TABLE or FILE.
Following method shows how to enable it in table without restarting,
Also same you can apply in my.cnf
Structure usually created with mysql installation if you don't see could be old structure.
try running mysql_upgrade
CREATE TABLE `general_log` ( `event_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `user_host` mediumtext, `thread_id` INT(11) DEFAULT NULL, `server_id` INT(11) DEFAULT NULL, `command_type` VARCHAR(64) DEFAULT NULL, `argument` mediumtext) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
You can choose log_output to be file OR table OR both.
Following command can help you apply changes without restart.
SET GLOBAL log_output='TABLE'; SET GLOBAL general_log='ON';
How to flush log.
mysql -u root -pp4ssw0rd -e "TRUNCATE TABLE mysql.general_log"
If you were planning to drop a partition, you may need to back it up. find out the range of the partition by
show create table tablename
replace the range fields as follows:
mysqldump -S --no-create-info --where="RANGE(day) >= lowrange AND RANGE(day) < highrange" database_name table_name > /jtmp/table.sql
Simple command to read binlog is
You can use following regularly used options.
--start-datetime= --start-position= --server-id=
I've started seeing following error in my log.
[ERROR] /usr/libexec/mysqld: Can't open file:
It is caused by file discriptor limit set by the system.
You can check that by changing your shell to mysql user and running following command.
In order to increase the open file limit.
edit following file.
mysql soft nofile 49152 mysql hard nofile 65536
Now you can check mysql for limit seen by mysql.
login to mysql as root and run following command.
Now you can modify it to increased limit in limits.conf.
by editing following file.
[mysqld] open-files-limit=49152 [mysqld_safe] open-files-limit=49152
restart mysql and check again it should represent new value.
I've stumble across this issue while running mariadb server in VM Guest.
I believe this happens sometime when VDP is doing backup or machine is being migrated by DRS.
In order to fix the issue, following command usually fix the issue.
systemctl stop mariadb cd /var/lib/mysql for i in `find . -name '*.ibd'`; do mv $i $i.bk; cp -a $i.bk $i ; rm $i.bk ; done systemctl start mariadb