mysql操作语句


/*修改密码*/
use mysql
update user set Password=password('新密码') where User='root';
update user set Password=old_password('新密码') where User='root';

/*增加用户,设置权限*/
create database 数据库名;
show databases;
use mysql
grant all on 数据库名.* to 用户名@localhost identified by "密码";
grant all on 数据库名.* to 用户名@"%" identified by "密码";
flush privileges;


show databases;
CREATE DATABASE `数据库名`;
use mysql;
grant all on 数据库名.* to 用户名@localhost identified by "密码";
grant all on 数据库名.* to 用户名@"%" identified by "密码";
update user set Password=old_password('密码') where Host='localhost' and user='easycms';
flush privileges;


MySQL数据库备份
mysqldump -h127.0.0.1 -uroot -proot 数据库名 > d:\*.sql

MySQL数据库压缩备份
mysqldump -h127.0.0.1 -uroot -proot 数据库名 > D:\*.sql.gz

还原MySQL数据库
mysql -h127.0.0.1 -uroot -proot 数据库名 < d:\*.sql

还原压缩的MySQL数据库
mysql -h127.0.0.1 -uroot -proot 数据库名 < D:\*.sql.gz

posted on 2013-11-13 08:50  xgh220  阅读(98)  评论(0)    收藏  举报