Skip to content

Instantly share code, notes, and snippets.

@zhangskills
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhangskills/2b526a00898f618ab354 to your computer and use it in GitHub Desktop.
Save zhangskills/2b526a00898f618ab354 to your computer and use it in GitHub Desktop.
mysql相关
@zhangskills
Copy link
Author

允许远程访问:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY '123456' WITH GRANT OPTION;
FLUSH PRIVILEGES

@zhangskills
Copy link
Author

查看Mysql数据库大小

  1. 进入information_schema 数据库(存放了其他的数据库的信息)

    use information_schema;

  2. 查询所有数据的大小:

    select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables;

  3. 查看指定数据库的大小:

    `select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='库名';

  4. 查看指定数据库的某个表的大小:

    select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='库名' and table_name='表名';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment