更改MySQL提示符
mysql> prompt \u@mysql \r:\b:\s
查找以my开头的数据库
mysql> show databases like 'my%'
删除用户所有
mysql> delete from mysql.user;
添加用户权限
mysql> grant all privileges on *.* to system@'%' identified by '123qwe' with grant option;
立即生效
mysql> flush privileges;
查看当全用户权限和密码状况
mysql> select user,host,password from mysql.user;
为管理员设置密码
shell > mysqladmin -u system password '123qwe'
为管理员修改密码
1、shell > mysqladmin -u system -p123qwe password '123123'
2、mysql> update mysql.user set password=password("456") where user='system' and host='localhost';
mysql> flush privileges;
3、set password=password("123");
查看表结构
mysql> desc mysql.user;
找回丢失的mysql密码
shell
> /etc/init.d/mysqld stop
shell
> mysqld_safe
--skip-grant-tables –user=mysql & 单实例
shell
>mysqld_safe
--defaults-file=/data/3306/my.cnf --skip-grant-table & 多实例
mysql>
update mysql.user set password=password("456") where
user='system' and host='localhost';
mysql>
flush privileges;
shell
> mysqladmin -u -p shutdown