分类: Mysql/postgreSQL
2008-12-04 19:49:55
更改数据文件存放目录:
|
/etc/rc.d/init.d/mysql
修改datadir一行,重新发动mysql
设置用户密码
mysql> update mysql.user set password = password('密码') where user=
'v' and host = 'localhost';
删除用户
drop user ;
or
mysql>Delete FROM user Where User="fred" and Host="localhost";
mysql>flush privileges;
刷新权限
mysql> flush privileges;
创建数据库
mysql>create database test;
将test数据库的所有权限授权给用户v
grant all privileges on test.* to identified by 'l';
如果想指定部分权限给一用户
mysql>grant select,update on DB.* to identified by 'l';
刷新系统权限表。
mysql>flush privileges;
删除用户的数据库
mysql>drop database test;
列出所有数据库
mysql>show database;
切换数据库
mysql>use '数据库名';
列出所有表
mysql>show tables;
显示数据表结构
mysql>describe 表名;
删除数据库和数据表
mysql>drop database 数据库名;
mysql>drop table 数据表名;
trouble shooting
ERROR 1045 (28000): Access denied for user
mysql> select host,user from user;
+------------------+------+
| host | user |
+------------------+------+
| % | test |
| localhost | |
| localhost | root |
| test.saeg.com.cn | |
| test.saeg.com.cn | root |
+------------------+------+
delete from user where user = '';