Mysql Commands

start service: mysqld --console;

start client: mysql -uroot -proot;

check server version: show variables like '%version%';

check status: status or show veriables like '%char%';

change charset:

  SET character_set_client='utf8';
  SET character_set_connection='utf8';
  SET character_set_results='utf8';

run sql script: source file_name;

create user: 

  CREATE USER quickcom@'localhost' IDENTIFIED BY 'dev';
  CREATE USER userRemote@'%' IDENTIFIED BY 'test';

grant: grant select,insert,update,delete on kuaikua.* to quickcom@'localhost' identified by 'dev';

delete database: drop database db_name;

database export: 

  export db schema: mysqldump -h[host] -u[user] -p[password] -d db_name > script_name.sql;
  export db.table schema: mysqldump -h[host] -u[user] -p[password] -d db_name table_name > script_name.sql;

  export db schema with data: mysqldump -h[host] -u[user] -p[password] db_name > script_name.sql;
  export db.table schema with data: mysqldump -h[host] -u[user] -p[password] db_name table_name > script_name.sql;

 

 

posted @ 2014-01-21 21:06  cloudyland  阅读(204)  评论(0编辑  收藏  举报