Attitude is everything. Change your attitude and change your life!
2013年(11)
分类: Mysql/postgreSQL
2013-02-21 12:00:51
mysql更改root的密码:
mysqladmin -u root -p password zbhdpx
mysql -u root -p
use mysql;
update user set password=PASSWORD('ZOCC.NET') where user='root';
flush privileges;
user mysql;
update user set password='' where user='root'; 改为空密码
flush privileges;
user mysql;
set password for 'root'@'localhost'=PASSWORD('ccb.com');
set password for 'root'@'localhost'='' 改为空密码
grant all privileges on *.* to zbhdpx@localhost identified by 'zbhdpx'
添加一个用户zbhdpx,密码为zbhdpx,授于所有权限,除了grant
grant all privileges on *.* to zbhdpx@localhost identified by ''
添加一个用户zbhdpx,授于所有权限,除了grant
grant select,update,insert,delete on ccb.* to zbhdpx@localhost
授于zbhdpx用户修改ccb数据库的权限,
grant select,update,insert,delete on ccb.* to zbhdpx@localhost with grant option;
授于zbhdpx用户对ccb数据库管理权限
revoke all privileges on *.* from zbhdpx@localhost
收回zbhdpx的所有权限
revoke all privileges on ccb.* from zbhdpx@localhost
收回zbhdpx对ccb数据库修改数据的权限
revoke grant option on ccb.* from zbhdpx@localhost
收回zbhdpx对ccb数据库管理的权限
delete from user where user='zbhdpx'
删除mysql.user表中的zbhdpx用户。
drop user zbhdpx@localhost
删除数据库中zbhdpx用户。
show processlist;
显示进程
show open tables;
显示打开的表
select version(),current_date;
显示数据库版本和当前时间
flush tables ccb.user
关闭打开的表。
show grants for root@localhost;
显示root@localhost权限
use mysql; select * from user;
显示系统用户表.
show now();
显示当前时间
show user();
显示当前用户
show database;
显示当前使用的数据库
create tabse test2 select * from test1;
复制表
rename tabse test2 to test1;
重命名表
select * from students order by id limit 9,10;
根据id排序显示10-20行
mysql -u adminzocc -p -e 'use ftpusers;select * from users order by User limit 9,10;'
添加"-e"选项后,可以使用shell来直接操作数据库