MySQL常用命令

来源:互联网 发布:淘宝猫胡子是假货吗 编辑:程序博客网 时间:2024/06/16 12:48

-- 创建数据库用户test
mysql> create user test identified by 'password';


-- 删除数据库用户test
mysql> drop user 'test'@'%';;


-- 将数据库test赋予用户qhmydbuser经由192.168.*.*的ip远程访问
mysql> grant all privileges on test.* to 'test'@'192.168.%.%' identified by 'password';

 
-- 查看用户授权表
mysql > select user, password, host from user; 


-- 取消授权
mysql> revoke update on test.* from 'test'@'192.168.%.%';


-- 创建数据库test
mysql> create database test default character set utf8 collate utf8_general_ci;


-- 删除数据库
mysql > drop database test;


-- 备份数据库test至backup.sql
shell> mysqldump -hlocalhost -uroot -p test > backup.sql


-- 将bakcup.sql导入test数据库
shell> mysql -hlocalhost -uroot -p test < backup.sql


原创粉丝点击