Home > Database > Mysql Tutorial > body text

mysql远程连数据之经验总结_MySQL

WBOY
Release: 2016-06-01 13:36:04
Original
985 people have browsed it

bitsCN.com

mysql远程连数据之经验总结

 

[sql] 

1. 新增用户  

[sql] 

mysql>insert into mysql.user(Host,User,Password) values("localhost","lionbule",password("hello1234"));  

mysql>flush privileges;  

2. 修改用户密码  www.bitsCN.com  

[sql] 

mysql>update mysql.user set password=password('new password') where User="lionbule" and Host="localhost";  

mysql>flush privileges;  

 

3. 删除用户

[sql] 

mysql>DELETE FROM user WHERE User="lionbule" and Host="localhost";  

mysql>flush privileges;  

 

4. 权限分配

    4.1. grant用法

           grant 权限 on 数据库.* to 用户名@'登录主机' identified by '密码'

[sql] 

权限:    

    常用总结, ALL/ALTER/CREATE/DROP/SELECT/UPDATE/DELETE    

数据库:    

     *.*                    表示所有库的所有表    

     test.*                表示test库的所有表    

     test.test_table  表示test库的test_table表         

用户名:    

     mysql账户名    

登陆主机:      www.bitsCN.com  

     允许登陆mysql server的客户端ip    

     '%'表示所有ip    

     'localhost' 表示本机    

     '192.168.10.2' 特定IP    

密码:    

      账户对应的登陆密码    

举例如下:

 

[sql] 

mysql>grant all  on test.* to lionbule@'%' identified by 'hello1234';  

mysql>flush privileges;  

 

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