tomcat 登录时用户名和密码问题

在编程的时候我们经常在myeclipes中直接部署web程序,大多数情况下不会登陆tomcat,这样时间长了我们就忘记了tomcat的登陆用户名和密码,下面就说一下怎么找到tomcat的用户名和密码吧,
首先,你必须的知道你的tomcat安装在什么地方了,比如我的就装在 D:Program FilesApache Software Foundation下面;
接着,我们在安装文件夹下面找到tomcat-users.xml文件,一般情况下实在这样一个文件目录下面的  D:Program FilesApache Software FoundationTomcat 6.0conf;
最后用记事本打开tomcat-users.xml文件,内容大概如下:

<?xml version='1.0' encoding='cp936'?>
<tomcat-users>
<!--
  NOTE:  The sample user and role entries below are wrapped in a comment
  and thus are ignored when reading this file. Do not forget to remove
  <!.. ..> that surrounds them.
-->
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
</tomcat-users>

这里我们发现没有manager的权限,而我们需要的就是在manager中操作,所以我们要创建一个manager的管理权限如下面红色部分


<?xml version='1.0' encoding='cp936'?>
<tomcat-users>
<!--
  NOTE:  The sample user and role entries below are wrapped in a comment
  and thus are ignored when reading this file. Do not forget to remove
  <!.. ..> that surrounds them.
-->
 
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
 
<user username="admin" password="admin" roles="manager"/>
</tomcat-users>

这样的话保存后关闭,然后重新启动tomcat就可以使用 用户名:admin  和密码:admin来登录manager管理了
 
转自:http://blog.sina.com.cn/s/blog_92b451ac0100y8w7.html
原文地址:https://www.cnblogs.com/shanmao/p/3405619.html