zoukankan      html  css  js  c++  java
  • MySQL基础

    为数据库创建特定的用户和密码

    mysql>grant all privileges on <database>.* to '<username>'@'localhost' identified by '<password>';
    mysql>grant all privileges on <database>.* to '<username>'@'localhost' identified by '<password>';
    

    举例,为icebug用户创建专属的数据库icebug_db,且密码为icebug_passwd

    mysql>create database icebug_db;
    mysql>grant all privileges on icebug_db.* to 'icebug'@'localhost' identified by 'icebug_passwd';     # 目的是本地可访问
    mysql>grant all privileges on icebug_db.* to 'icebug'@'%' identified by 'icebug_passwd';             # 目的是远程主机可以访问
    

    创建好了之后就可以直接通过用户icebug和密码icebug_passwd登陆数据库系统了,注意通过icebug账号和icebug_passwd登陆之后只能看到数据自己的数据库,并不能看到别人的数据库,这也是为什么要为特定数据库创建特定账号和密码了,千万注意不要人手一个root账号和密码.....

    登陆

    icebug@localhost:~$ mysql -uicebug -picebug_passwd
    

    这样就可以登陆icebug的数据库了~

    tips:

    最好不要这样直接把密码放到命令行里一块敲,不然很容易在bash history中留下密码痕迹,出于安全考虑还是通过mysql -uicebug -p之后再敲入密码为好。

  • 相关阅读:
    angularjs中ng-repeat-start与ng-repeat-end用法实例
    随笔 javascript-抽象工厂模式
    VMware一些使用心得
    oracle 12c的数据库导进 11g
    架构师基本功:消息队列
    如何提高工作效率
    oracle 12c 13姨
    架构师基本功:SOA
    autofac如何注册静态方法里的接口对象
    发布Java桌面程序
  • 原文地址:https://www.cnblogs.com/dspace/p/6111621.html
Copyright © 2011-2022 走看看