zoukankan      html  css  js  c++  java
  • linux下创建新用户新数据库并远程访问

    1.用root账户登录

    # mysql -u root -p

    2.选择mysql权限数据库

    # use mysql;

    3.插入账户

    # insert into user (Host,User,Password) values ('%','myuser',password('mypw'));

    更新权限

    # flush privileges;

    4.创建数据库

    # create database mytestdb;

    5.指定数据库的访问账户

    #  grant all privileges on mytestdb.* to 'myuser'@'%' identified by 'mypw';

    更新权限

    # flush privileges;

    搞定~~~~

    注:user表的host字段‘%’表示允许外部访问。

     如果需要在xshell下访问数据库需要追加一个host

    # insert into user (Host,User,Password) values ('localhost','myuser',password('mynewpw'));

    更新权限

    # flush privileges;

    这里的密码可以与外部访问的不一致,同时,不需要更新数据库的访问账户,因为上一步已经添加了。

  • 相关阅读:
    ZOJ 3818 Pretty Poem
    HDU 4597 Play Game
    HDU 4497 GCD and LCM
    CSU 1335 高桥和低桥
    UVA 10791 Minimum Sum LCM
    CSU 1119 Collecting Coins
    CSU 1120 病毒
    UVA 12169 Disgruntled Judge
    HDU 1301 Jungle Roads
    POJ 1258 Agri-Net
  • 原文地址:https://www.cnblogs.com/luxx/p/2955617.html
Copyright © 2011-2022 走看看