Home > Database > Mysql Tutorial > mysql用户授权_MySQL

mysql用户授权_MySQL

WBOY
Release: 2016-06-01 13:44:59
Original
729 people have browsed it

bitsCN.com

mysql 用户授权
 
默认情况下 mysql 是以root 用户进入 并且操作的,那么要想以其他用户进入并且对数据库进行增删改查的工作那么就需要 以root 用户的身份进入 给数据库授权 给 相应的用户
 
server0:/usr/local/mysql/bin # mysql -uroot -p
Enter password:
 
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| solrclient         |
| test               |
+--------------------+
 
mysql> grant all privileges on solrclient.* to suse@localhost identified by 'suse‘;
Query OK, 0 rows affected (0.00 sec)
 
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql>/q
 
还可以进行更细粒度的 授权:
 
//如果想指定部分权限给一用户,可以这样来写:
mysql>grant select,update on solrDB.* to suse@localhost   identified by ‘suse’;
 
3.删除用户
  @>mysql -u root -p
  @>密码
  mysql>DELETE FROM user WHERE User='suse'and Host=”localhost”;
  mysql>flush privileges;
  //删除用户的数据库
  mysql>drop database  solrDB;
  4.修改指定用户密码
  @>mysql -u root -p
  @>密码
  mysql>update mysql.user set password=password(‘新密码’) where User='suse' and Host=”localhost”;
  mysql>flush privileges;
  mysql>quit;

作者“715356603-qq-com”
 

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template