标签:
show processlist; 也可以查information_schema.processlist表
show variables like ‘%参数名字%‘;
revoke SELECT, EXECUTE, SHOW VIEW ON `tsdp`.* from ‘tsdp_ro‘@‘10.58.%.%‘ ;
set session 参数名字=值;
set global 参数名字=值;
show global status;
show status like ‘%参数名字%‘;
show slave status\G 做主从同步 change master to.....
create user test@‘111.111.111.111‘ identified by ‘123456‘;
grant all on clus.* to test@‘111.111.111.111‘;
use clus;
show triggers;
show create trigger triggername; 可以在information_schema.trigger差看
use clus;
show procedure status;
show create procedure procedurename;
use clus;
show events;
show create event eventname;
CREATE DATABASE IF NOT EXISTS yourdbname DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
alter table tablename add column name varchar(10);
alter table tablename add column `ID` int primary key auto_increment;
alter table tablename modify column name varchar(10);
alter table tablename drop clumn name;
alter table tablename add index index_name (字段);
alter table tablename drop index index_name;
create index index_name on tablename(字段);
drop index index_name on tablename;
alter table tablename add primary key (`ID`) auto_increment;
1.alter table tablename modify column `ID` int
2.alter table tablename drop primary key (`ID`);
/usr/local/mysql/bin/mysqldump -uroot -p‘vxxx‘ -h127.0.0.1 -P3306 --databases 库名 --lock-all-tables --master-data > axx_20130607.sql 不锁就去掉--lock-all-tables --master-data
mysqladmin flush-hosts
select Host,User,Password,max_questions,max_updates,max_connections,max_user_connections from mysql.user;
alter table your_table_name engine=‘Innodb‘;
select * from information_schema.tables where TABLE_SCHEMA not in (‘mysql‘,‘information_schema‘,‘performance_schema‘) and engine != ‘InnoDB‘;
mysqldump -u*** -p -d your_database_name > database_structure.sql
show grants for root@‘127.0.0.1‘;
UPDATE mysql.user SET Grant_priv=‘Y‘, Super_priv=‘Y‘ WHERE User=‘root‘;
FLUSH PRIVILEGES;
SELECT DISTINCT CONCAT(t.table_schema, ‘.‘ ,t.table_name) as tbl, t.engine, IF( ISNULL (c.constraint_name), ‘NOPK‘ , ‘‘ ) AS nopk, IF(s.index_type = ‘FULLTEXT‘ , ‘FULLTEXT‘ , ‘‘ ) as ftidx, IF(s.index_type = ‘SPATIAL‘ , ‘SPATIAL‘ , ‘‘ ) as gisidx FROM information_schema.tables AS t LEFT JOIN information_schema.key_column_usage AS c ON (t.table_schema = c.constraint_schema AND t.table_name = c.table_name AND c.constraint_name = ‘PRIMARY‘ ) LEFT JOIN information_schema. statistics AS s ON (t.table_schema = s.table_schema AND t.table_name = s.table_name AND s.index_type IN ( ‘FULLTEXT‘ , ‘SPATIAL‘ )) WHERE t.table_schema NOT IN ( ‘information_schema‘ , ‘performance_schema‘ , ‘mysql‘ ) AND t.table_type = ‘BASE TABLE‘ AND (t.engine <> ‘InnoDB‘ OR c.constraint_name IS NULL OR s.index_type IN ( ‘FULLTEXT‘ , ‘SPATIAL‘ )) ORDER BY t.table_schema,t.table_name; |
源数据库mysql特性统计
select * from mysql.func; select * from information_schema.ROUTINES where ROUTINE_SCHEMA = ‘win4‘ ; select * from mysql.event; select * from information_schema.EVENTS where EVENT_SCHEMA = ‘win4‘ ; select * from mysql.proc; select * from information_schema.VIEWS where TABLE_SCHEMA = ‘win4‘ ; select * from information_schema.TRIGGERS where TRIGGER_SCHEMA = ‘win4‘ ; select * from information_schema.tables where table_schema= ‘win4‘ and engine != ‘InnoDB‘ ; select * from information_schema. STATISTICS where table_schema = ‘win4‘ and INDEX_TYPE in ( ‘FULLTEXT‘ , ‘SPATIAL‘ ); select t.table_schema,t.TABLE_NAME,c.CONSTRAINT_TYPE from information_schema.tables t left join information_schema.TABLE_CONSTRAINTS c on t.TABLE_SCHEMA = c.TABLE_SCHEMA and t.TABLE_NAME = c.TABLE_NAME and c.CONSTRAINT_TYPE = ‘PRIMARY KEY‘ where t.TABLE_SCHEMA = ‘win4‘ and c.CONSTRAINT_TYPE is null ; |
标签:
原文地址:http://www.cnblogs.com/shine009/p/4310303.html