標籤:
更改MySQL提示符
mysql> prompt \[email protected] \r:\b:\s
尋找以my開頭的資料庫
mysql> show databases like ‘my%‘
刪除使用者所有
mysql> delete from mysql.user;
添加使用者權限
mysql> grant all privileges on *.* to [email protected]‘%‘ 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") whereuser=‘system‘ and host=‘localhost‘;
mysql>flush privileges;
shell> mysqladmin -u -p shutdown
MySQL找回管理員密碼