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
创建用户:
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 ;