SQL代码
  1. insert into mysql.user(Host,User,Password) values ("%","admin",password("cnmo"));  
  2.   
  3. CREATE USER 'admin'@'localhost' IDENTIFIED BY 'cnmo';  
  4. GRANT privileges ON *.* TO 'admin'@'localhost';  
  5. GRANT ALL privileges on *.* to 'admin'@'localhost' identified by 'cnmo';  
  6. FLUSH PRIVILEGES;  

 更新用户密码

SQL代码
  1. use mysql # 连接权限数据库  
  2. update user set password=password('521'where user='root' and host='localhost'; # 改密码  
  3. flush privileges; # 刷新权限  

 

数据库技术 | 评论(0) | 引用(0) | 阅读(762)