ITeye博客

MySQL汉字字段按拼音排序和备份

tiroc · 2010-09-18 11:41 · MySQL · 数据库 · MySQL · 排序 · 备份 · 用户 · Markdown

UTF-8编码的数据库,如果希望汉字字段按照拼音排序:

SELECT * FROM students ORDER BY CONVERT( name USING gbk ) ;

 原文地址:http://blog.csdn.net/stephenxu111/archive/2009/08/11/4436181.aspx

 

 

数据库备份:

 

#mysqldump最常用于备份一个整个的数据库:

shell> mysqldump -u username -p --opt db_name > backup-file.sql

#你可以这样将转储文件读回到服务器:

shell> mysql -u username -p db_name < backup-file.sql

 

 mysqldump 只导出数据 或者 只导出表结构

 

创建用户:

 

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';

  

为用户分配访问权限:

 

GRANT ALL ON database_name.* TO 'username'@'localhost';

 

查看用户权限:

 

show grants;
show grants for username;
show grants for username@localhost;

 

修改用户密码:

 

set password for username@’localhost’ = password(‘newpassword’); 
flush privileges;

取消用户授权:

 

revoke all on *.* from sss@localhost ;

 

删除用户:

 

use mysql
delete from user where user='name' and host='localhost' ;
flush privileges ;

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。