zoukankan      html  css  js  c++  java
  • Mysql创建用户并授权以及开启远程访问

    一、创建用户并授权

    1、登录

      mysql  mysql -u root -p

    2、创建数据库  

      create database test;//以创建test为例

    3、创建用户创建user01,只能本地访问  

      create user user01@'localhost' identified by 'password';

      创建user02,可以远程访问  

      create user user02@'%' identified by 'password'

    4、修改用户密码以user01为例:  

      set password for 'user01'@'localhost'=password('anotherpassword')

    5、授权授予user01管理test的全部权限  

      grant all privileges on test.* to user01;

      授予user02查看权限,并修改密码  

        grant select on *.* to 'user02'@'%' identified by 'anotherpassword';

      授予所有权限

        GRANT ALL PRIVILEGES ON *.* TO zhangsan@"%" IDENTIFIED BY "lisi";

    二、设置mysql允许远程连接(ubuntu系统)

    1、 sudo vi /etc/mysql/my.cnf

    2、注释掉如下两行:  bind-address=127.0.0.1  skip-network(mysql5.6版本里没有这行)

    3、sudo service mysql restart

    结合一中的授权,被授权用户可以远程访问 

  • 相关阅读:
    Link标签的media属性
    Moss2007ctx问题
    Moss2007 ListTemplate
    Html body的滚动条禁止与启用
    DOM的事件冒泡
    IE解析UL和LI的规则和问题
    AT&T汇编语言语法(一)(转)
    Linux 汇编语言开发指南 (转)
    Python 模块 jwt
    Excel2003和excel2007读取方法
  • 原文地址:https://www.cnblogs.com/ldcheng/p/11905513.html
Copyright © 2011-2022 走看看