`

mysql 命令

阅读更多
导出导入
  mysqldump -uroot -p 数据库名称 > 目标文件
  mysqldump -uroot -p 数据库名称.表名 > 目标文件
  mysqldump -uroot -p -d 数据库名称.表名 > 目标文件 只导出结构
查看数据库大小
  use information_schema;
  查看数据库大小
  select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='home';
  查看数据库表大小
  select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='home' and table_name='members';

添加用户
  grant all privileges on *.* to joe@localhost identified by '1';
  flush privileges;
查询用户
  SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
用户权限
  show grants for 'cactiuser'@'%';
  select * from mysql.user where user='cactiuser'
创建utf8数据库:
   CREATE DATABASE `test2` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics