-----------------------------------------------------------------------
windows 下 C:/mysql5/bin>mysql -uroot -panywolfs.com /删除现有的数据 drop database anywolfs_db; /创建数据库 create database anywolfs_db; /创建用户 create user anywolfs(用户) identified by 'anywolfs.com(密码)'; /查看所有数据库 show databases; /查看系统表 use mysql; show tables; /查看所有用户 select * from user; /修改用户的密码 update user set password=password('anywolfs.com') where user='anywolfs'; 或者(linux下): /usr/local/mysql/bin/mysql -uroot -panywolfs -e "update user set password=PASSWORD('00000000') where user='anywolfs'" mysql /usr/local/mysql/bin/mysql -uroot -pbips2000 -e "flush privileges" mysql /为用户赋权 grant select,insert,delete,create,drop on anywolfs_db.* (*.* 或test.*/user.*/..) to anywolfs@localhost (用户@localhost/用户@%/用户@127.0.0.1) identified by '密码'; /让更改生效 flush privileges; anywolfs_db.*, "."前面表示数据库,后面便是所有表, anywolfs@localhost "@" 前面表示用户,后面表示可以管理该库的ip,所有ip用 % ,或者一个具体的ip地址:127.0.0.1 mysql 查看耗资源(linux下): /usr/local/mysql/bin/mysqladmin -uroot -panywolfs proc |grep anywolfs_db /usr/local/mysql/bin/mysqladmin -uroot -panywolfs processlist | grep Locked| awk '{if($12 > 100) print}' /usr/local/mysql/bin/mysqladmin -uroot -panywolfs processlist | grep Query| awk '{if($12 > 100) print}' /usr/local/mysql/bin/mysqladmin -uroot -panywolfs processlist | grep Sleep | awk '{if($12 > 100) print}'