本節中的信息主要適用選擇NoinstallMySQL安裝版本,或想要手動配置和測試MySQL而不用GUI工具的情況。
在Windows 95,98,或Me中,MySQL客戶端總使用TCP/IP連接服務器。(這樣允許網絡中的所有機器連接MySQL服務器)。因此,在啟動MySQL之前,你必須確保機器支持TCP/IP。可以從Windows CD-ROM中找到TCP/IP。
請注意如果使用舊版本的Windows 95(例如,OSR2),很可能你使用了舊的Winsock包;MySQL需要Winsock 2。可以從http://www.microsoft.com/獲得最新的Winsock。Windows 98包含新的Winsock 2庫,因此不需要更新庫。
在基于NT的系統中,例如 Windows NT、2000、XP或2003,客戶端可以有兩個選擇。可以使用TCP/IP,如果服務器支持命名管道連接,也可以使用命名管道。要想使MySQL使用Windows NT 4中的TCP/IP,你必須安裝服務pack 3(或更新的補丁)。
如果用--shared-memory選項啟動,Windows版MySQL還支持共享內存連接。客戶端可以通過--protocol=memory選項通過共享內存進行連接。
關于運行哪個服務器二進制的信息,參見2.3.9節,“選擇MySQL服務器類型”。
本節對MySQL服務器啟動進行了概述。下面章節詳細說明了從命令行或Windows 服務啟動MySQL服務器的具體信息。
這些章節的例子假定MySQL安裝到默認位置C:Program FilesMySQLMySQL Server 5.1。如果你將MySQL安裝到了其它位置,則要更改例子中的路徑名。
在控制臺窗口(或“DOS window”)中,最好根據命令提示進行測試。這樣可以讓服務器在window中容易看見的地方顯示狀態消息。如果配置出現錯誤,通過這些消息,可以更容易地識別并修復問題。
要想啟動服務器,輸入命令:
C:> C:Program FilesMySQLMySQL Server 5.1inmysqld --console
支持InnoDB的服務器啟動時,你應當能看見下面的消息:
InnoDB: The first specified datafile c:ibdataibdata1 did not exist:
InnoDB: a new database to be created!
InnoDB: Setting file c:ibdataibdata1 size to 209715200
InnoDB: Database physically writes the file full: wait...
InnoDB: Log file c:iblogsib_logfile0 did not exist: new to be created
InnoDB: Setting log file c:iblogsib_logfile0 size to 31457280
InnoDB: Log file c:iblogsib_logfile1 did not exist: new to be created
InnoDB: Setting log file c:iblogsib_logfile1 size to 31457280
InnoDB: Log file c:iblogsib_logfile2 did not exist: new to be created
InnoDB: Setting log file c:iblogsib_logfile2 size to 31457280
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: creating foreign key constraint system tables
InnoDB: foreign key constraint system tables created
011024 10:58:25 InnoDB: Started
服務器完成啟動序列后,你應當能看見下述內容,表示服務器準備好,可以進行客戶端連接:
mysqld: ready for connections
Version: '5.1.2-alpha' socket: '' port: 3306
服務器繼續向控制臺寫入診斷輸出。你可以打開新的控制臺窗口運行客戶端程序。
如果省略--console選項,服務器向數據目錄(默認為C:Program FilesMySQLMySQL Server 5.1data)中的錯誤日志寫入診斷輸出。錯誤日志文件的擴展名為.err。
注釋:MySQL授權表中的賬戶一開始沒有密碼。服務器啟動后,你應當根據2.9節,“安裝后的設置和測試”中的說明設置密碼。