ITPub博客

首页 > Linux操作系统 > Linux操作系统 > mysql手工添加root用户

mysql手工添加root用户

原创 Linux操作系统 作者:myownstars 时间:2011-02-12 10:56:37 0 删除 编辑

Mysqlroot用户是可以手工添加的,也可以通过grant赋权添加

 

1

mysql> select host,user from user;

+-----------------------+----------------+

| host                  | user           |

+-----------------------+----------------+

| %                     | market         |

| %                     | marketuser     |

| %                     | orderuser      |

| %                     | qryorders_user |

| %                     | yhd_mobile     |

| %                     | yhd_user       |

| 10.1.0.99             | monitor        |

| 127.0.0.1             | root           |

| localhost             | root           |

| localhost.localdomain | root           |

+-----------------------+----------------+

10 rows in set (0.00 sec)

 

mysql> insert into user(host,user,password) values('%','root',password('my_passsword'));

Query OK, 1 row affected, 3 warnings (0.00 sec)

 

mysql> select host,user from user;

+-----------------------+----------------+

| host                  | user           |

+-----------------------+----------------+

| %                     | market         |

| %                     | marketuser     |

| %                     | orderuser      |

| %                     | qryorders_user |

| %                     | root           |

| %                     | yhd_mobile     |

| %                     | yhd_user       |

| 10.1.0.99             | monitor        |

| 127.0.0.1             | root           |

| localhost             | root           |

| localhost.localdomain | root           |

+-----------------------+----------------+

 

2

mysql> select host,user from user;

+-----------------------+----------------+

| host                  | user           |

+-----------------------+----------------+

| %                     | market         |

| %                     | marketuser     |

| %                     | orderuser      |

| %                     | qryorders_user |

| %                     | yhd_mobile     |

| %                     | yhd_user       |

| 10.1.0.99             | monitor        |

| 127.0.0.1             | root           |

| localhost             | root           |

| localhost.localdomain | root           |

+-----------------------+----------------+

10 rows in set (0.00 sec)

 

mysql> grant all privileges on *.* to root@"%";

Query OK, 0 rows affected (0.00 sec)

 

mysql> select host,user from user;

+-----------------------+----------------+

| host                  | user           |

+-----------------------+----------------+

| %                     | market         |

| %                     | marketuser     |

| %                     | orderuser      |

| %                     | qryorders_user |

| %                     | root           |

| %                     | yhd_mobile     |

| %                     | yhd_user       |

| 10.1.0.99             | monitor        |

| 127.0.0.1             | root           |

| localhost             | root           |

| localhost.localdomain | root           |

+-----------------------+----------------+

11 rows in set (0.00 sec)

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15480802/viewspace-687057/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-03-18

  • 博文量
    375
  • 访问量
    3111716