2020年11月27日 星期五

mariadb command

 1. Show table schema

show create table TABLENAME;

describe TABLENAME;


2.  show db parameter

show status like '%max%';


3. show all table and databases;

show  tables;
show databases;


4. Show Indexs;

show indexes from TABLENAME;

ref 1


4.2 Index For Hash and B-Tree
https://dev.mysql.com/doc/refman/8.0/en/index-btree-hash.html
https://stackoverflow.com/questions/7306316/b-tree-vs-hash-table


4.3 Index type
https://mariadb.com/kb/en/getting-started-with-indexes/

5. Analysze sequence 

show table status where name = 'tablename';

explain select * from tablename where condition;

ref 1


6.  deadlock

https://blog.gslin.org/archives/2014/10/29/5226/mysql-innodb-%E9%81%87%E5%88%B0-deadlock-%E6%99%82%E7%9A%84%E5%88%A4%E8%AE%80/

https://t.codebug.vip/questions-776021.htm


7. maraidb foreigin key

select concat(fks.constraint_schema, '.', fks.table_name) as foreign_table, '->' as rel, concat(fks.unique_constraint_schema, '.', fks.referenced_table_name) as primary_table, fks.constraint_name, group_concat(kcu.column_name order by position_in_unique_constraint separator ', ') as fk_columns from information_schema.referential_constraints fks join information_schema.key_column_usage kcu on fks.constraint_schema = kcu.table_schema and fks.table_name = kcu.table_name and fks.constraint_name = kcu.constraint_name -- where fks.constraint_schema = 'database name' group by fks.constraint_schema, fks.table_name, fks.unique_constraint_schema, fks.referenced_table_name, fks.constraint_name order by fks.constraint_schema, fks.table_name;

https://dataedo.com/kb/query/mariadb/list-foreign-keys


8. Look the priviledge

SHOW GRANTS;

https://dba.stackexchange.com/questions/63404/how-to-grant-super-privilege-to-the-user


9. Bin Log

https://kknews.cc/zh-tw/code/8vx9vbn.html

https://www.tw511.com/18/139/4051.html

http://benjr.tw/102425


10. Foregin key problem

https://www.cnblogs.com/shishibuwan/p/10863347.html




沒有留言:

張貼留言