在编程的时候我们经常在myeclipes中直接部署web程序,大多数情况下不会登陆tomcat,这样时间长了我们就忘记了tomcat的登陆用户名和密码,下面就说一下怎么找到tomcat的用户名和密码吧,
首先,你必须的知道你的tomcat安装在什么地方了,比如我的就装在 D:\Program Files\Apache Software Foundation下面;
接着,我们在安装文件夹下面找到tomcat-users.xml文件,一般情况下实在这样一个文件目录下面的 D:\Program Files\Apache Software Foundation\Tomcat 6.0\conf;
最后用记事本打开tomcat-users.xml文件,内容大概如下:
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安装在什么地方了,比如我的就装在 D:\Program Files\Apache Software Foundation下面;
接着,我们在安装文件夹下面找到tomcat-users.xml文件,一般情况下实在这样一个文件目录下面的
最后用记事本打开tomcat-users.xml文件,内容大概如下:
<?xml version='1.0' encoding='cp936'?>
<tomcat-users>
<!--
-->
</tomcat-users>
这里我们发现没有manager的权限,而我们需要的就是在manager中操作,所以我们要创建一个manager的管理权限如下面红色部分
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"/>
这里我们发现没有manager的权限,而我们需要的就是在manager中操作,所以我们要创建一个manager的管理权限如下面红色部分
<?xml version='1.0' encoding='cp936'?>
<tomcat-users>
<!--
-->
<user username="admin" password="admin" roles="manager"/>
</tomcat-users>
这样的话保存后关闭,然后重新启动tomcat就可以使用 用户名:admin 和密码:admin来登录manager管理了
这样的话保存后关闭,然后重新启动tomcat就可以使用 用户名:admin
==================================================================================
不同于以往的Tomcat版本,Tomcat7.0将manager角色细化为manager-gui,manager-script,manager-jmx,manager-status,所以要使用Tomcat7.0,需要首先去conf\tomcat-users.xml添加角色与用户信息,具体如下:
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user username="admin" password="admin" roles="manager-gui,manager-script,manager-jmx,manager-status"/>