首先出現(xiàn)的是安裝向?qū)g迎界面,直接點(diǎn)擊“next”繼續(xù),選擇安裝類型,選擇“自定義”custom安裝,然后點(diǎn)“next”下一步,出現(xiàn)自定義安裝界面,選擇安裝路徑:c:/mysql server 4.1(可自定義)點(diǎn)“ok”返回到自定義安裝界面,路徑已改為設(shè)置的路徑,點(diǎn)“next”,準(zhǔn)備開始安裝,點(diǎn)“install”開始安裝,完成后出現(xiàn)創(chuàng)建mysql.com帳號的界面。
“install as windows service”一定要勾選,這是將mysql作為windows的服務(wù)運(yùn)行。“service name”就用默認(rèn)的“mysql”下面的“l(fā)aunch the mysql server automatically”一定要勾選,這樣windows啟動時,mysql就會自動啟動服務(wù),要不然就要手工啟動mysql。
“create an anonymous account”是創(chuàng)建一個匿名帳號,這樣會導(dǎo)致未經(jīng)授權(quán)的用戶非法訪問你的數(shù)據(jù)庫,有安全隱患,建議不要勾選。
點(diǎn)“next”,mysql配置向?qū)⒁罁?jù)你上面的所有設(shè)定配置mysql,以便mysql的運(yùn)行符合你的需要,點(diǎn)“execute”開始配置,當(dāng)出現(xiàn)“service started successfully”時,說明你的配置完成,mysql服務(wù)啟動成功
彈出windows的服務(wù)管理器,然后就可以看見服務(wù)名為“mysql”的服務(wù)項(xiàng)了,其右邊標(biāo)明“已啟動”在開始菜單-所有程序-mysql-mysql server 4.1-mysql command line client用客戶端的快捷方式連接,輸入安裝時設(shè)置的密碼即可。
數(shù)據(jù)庫的使用
mysql安裝完畢以后,在開始菜單-所有程序-mysql-mysql server 4.1-mysql command line client用客戶端的快捷方式連接
<?xml version="1.0" encoding="iso-8859-1"?> <!doctype web-app public "-//sun microsystems,inc.//dtd web application 2.3//en" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <display-name>my web application</display-name> <description> a application for test. </description> </web-app>
import java.io.*;import javax.servlet.*;import javax.servlet.http.*;public class helloworld extends httpservlet{public void doget(httpservletrequest request,httpservletresponse response)throws servletexception,ioexception{response.setcontenttype("text/html"); printwriter out = response.getwriter();out.println("<html><head><title>");out.println("this is my first servlet");out.println("</title></head><body>");out.println("<h1>hello,world!</h1>");out.println("</body></html>");}}
package test; public class testbean{ private string name = null; public testbean(string strname_p){ this.name=strname_p; } public void setname(string strname_p){ this.name=strname_p; } public string getname(){ return this.name; } }
<%@ page import="test.testbean" %> <html><body><center> <% testbean testbean=new testbean("this is a test java bean."); %> java bean name is:<%=testbean.getname()%> </center></body></html>
重啟tomcat,啟動瀏覽器,輸入http://localhost:8080/myapp/testbean.jsp 如果看到輸出java bean name is: this is a test java bean 就說明編寫的javabean成功了。