Change MySQL prompt
mysql> prompt \[email protected] \r:\b:\s
Find to my database starting with
Mysql> show databases like ' my% '
Delete all Users
Mysql> Delete from Mysql.user;
Add User Rights
Mysql> Grant all privileges on * * to [e-mail protected] '% ' identified by ' 123qwe ' with GRANT option;
Immediate effect
mysql> flush Privileges;
View when full user rights and password conditions
Mysql> select User,host,password from Mysql.user;
Set a password for an administrator
Shell > mysqladmin-u System password ' 123qwe '
Change Password for administrator
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");
View table Structure
MySQL > desc mysql.user;
Retrieve the Lost MySQL Password
Shell>/etc/init.d/mysqld Stop
< Span style= "Font-family:tahoma, Sans-serif;" > shell> Mysqld_safe--skip-grant-tables–user=mysql & Single instance
shell>mysqld_safe--defaults-file=/data/3306/my.cnf--skip-grant-table & Multi-instance
Mysql>update Mysql.user Set Password=password ("456") whereuser= ' system ' and host= ' localhost ';
Mysql>flush privileges;
Shell> Mysqladmin-u-P shutdown
MySQL Recover admin password