Recently compiled mysql Common commands

Source: Internet
Author: User
Tags mysql delete

Recently compiled mysql Common commands --- view the master database log-binfile number and pos number mysql-uroot-pzqgame.com-e "show master status \ G" | cut-d: -f 2 | sed-n'2, 3p '--- View table information show table status \ G; --- mysql records slow SQL: log =/tmp/mysqld. sqllog-slow-queries =/data/mysql/slowquery. loglong_query_time = 2 --- view the table creation statement show create table tablename; --- view the table structure DESCRIBE table_name; --- you can view the complete execution of sqlshow full processlist; --- display all processes running in the system. Show processlist --- view the system resource show status --- view the variable, in my. show variables defined in the cnf configuration file --- view the error warnings generated by the last SQL statement. For more information, see. err log show warnings --- view error show errors --- view load \ s; -- reset mysql password service mysql stop mysqld_safe-skip-grant-table & mysql use mysql; update user set password = password ('test') where user = 'root'; --- alter table table_name convert to character set gbk/utf8; show variables like "% char %"; SET char Acter_set_client = 'gbk'; SET character_set_connection = 'gbk'; SET character_set_results = 'gbk'; --- query the size of all data select concat (round (sum (DATA_LENGTH/1024/1024 ), 2), 'mb ') as data from information_schema.TABLES; --- view the size of the specified database instance, for example, forexpert select concat (round (sum (DATA_LENGTH/1024/1024), 2 ), 'mb ') as data from information_schema.TABLES where table_schema = 'forexpert'; --- view the table size of the specified database, for example, in database forexpert Select concat (round (sum (DATA_LENGTH/1024/1024), 2), 'mb') as data from information_schema.TABLES where table_schema = 'forexpert 'and table_name = 'member '; --- view the version number select verison (); --- view the execution plan explain select... --- INDEX failure repair analyze table table_name; show index from table_name; --- repair table repair TABLE table_name; --- clear the log file purge master logs to 'mysql-bin.010 'starting with mysql-bin '; purge master logs before' 2008-12- 19 21:00:00 '; Note: If the slave server has been fully synchronized with the MASTER server, you can use the reset master to delete these files-partition table-related query partition name: select partition_name part, partition_expression expr, partition_description descr, table_rows from information_schema.partitions where table_schema = schema () and table_name = 'test'; alter table emp CHECK partition p1, p2; this command tells you the partition p1 of the emp TABLE, whether the data or index in p2 has been damaged. If this happens, use "alter table... repair partition" to fix the PARTITION. ---- Fix inconsistency between the master and slave pt-table-sync-execute-sync-to-master h = 10.232.31.109-databases test-uroot-p1234546 ---- mysql uninstalls and deletes the rpm package rpm-qa | grep -I mysqlrpm-e... delete the configuration file (or rename it) rm/etc/my. cnf Delete datadir directory rm/data/mysql Delete mysql service rm/etc/init. d/mysqlchkconfig -- del mysql Delete the scattered mysql folder whereis mysql Delete rm-rf/usr/lib/mysql/rm-rf/usr/share/mysql and above for the recently sorted common commands, it will be improved later.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.