实验指导书 (MySQL 5) V5.0
- 格式:doc
- 大小:3.99 MB
- 文档页数:74
MySQL 5.5Installation and Configuration Guide(for Windows)Part number: 5998-1361Software version: iMC PLAT 5.1 (E0202)Document version: 5P103-20111222Legal and notice information© Copyright 2010-2011 Hewlett-Packard Development Company, L.P.No part of this documentation may be reproduced or transmitted in any form or by any means without prior written consent of Hewlett-Packard Development Company, L.P.The information contained herein is subject to change without notice.HEWLETT-PACKARD COMPANY MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard shall not be liable for errors contained herein or for incidental or consequential damages in connection with the furnishing, performance, or use of this material.The only warranties for HP products and services are set forth in the express warranty statements accompanying such products and services. Nothing herein should be construed as constituting an additional warranty. HP shall not be liable for technical or editorial errors or omissions contained herein.Support and other resourcesContacting HPFor worldwide technical support information, see the HP support website:/supportBefore contacting HP, collect the following information:•Product model names and numbers•Technical support registration number (if applicable)•Product serial numbers•Error messages•Operating system type and revision level•Detailed questionsSubscription serviceHP recommends that you register your product at the Subscriber's Choice for Business website:/go/wwalertsAfter registering, you will receive email notification of product enhancements, new driver versions, firmware updates, and other product resources.Related informationDocumentsTo find related documents, browse to the Manuals page of the HP Business Support Center website:/support/manuals•For related documentation, navigate to the Networking section, and select a networking category.•For a complete list of acronyms and their definitions, see HP A-Series Acronyms. Websites• •HP Networking /go/networking•HP manuals /support/manuals•HP download drivers and software /support/downloads•HP software depot ConventionsThis section describes the conventions used in this documentation set. GUI conventionsConvention DescriptionBoldface Window names, button names, field names, and menu items are in bold text. For example, the New User window appears; click OK.> Multi-level menus are separated by angle brackets. For example, File > Create > Folder./ Multi-level menus are separated by forward slashes. For example, [File/Create/Folder]. SymbolsConvention DescriptionNOTE An alert that contains additional or supplementary information.ContentsOverview (1)MySQL server installation (2)MySQL client installation (2)Configuration (7)Configuring the MySQL server instance (7)Creating a database user (15)Startup and Stop (16)Uninstallation (17)Removing the MySQL server instance (17)Uninstalling the MySQL server (19)FAQ (21)OverviewThis document describes how to install and configure the MySQL server when it is used with iMC, and the installation and configuration guidelines. This document is applicable to the MySQL 5.1 and MySQL5.5 editions. The installation is slightly different from that for other editions. This document takes theMySQL 5.5 edition for example.NOTE:Install the MySQL server and start the MySQL service before installing the iMC.MySQL server installationBefore installing the MySQL server, obtain the MySQL installation program that is applicable to the Windows operating system. This document takes mysql-5.5.5-win32.msi installation program for example. Double click the program to start the setup wizard.Figure 1MySQL server setup wizardClick Next.Figure 2 License agreement pageSelect I accept the terms in the License Agreement and click Next.Figure 3 Select a setup typeTo use the default installation path, select Typical or Complete.To customize the installed components and installation path, select Custom. In this example, select Typical and click Next.Figure 4Ready to install the MySQL serverClick Install to install the MySQL server to the host.Figure 5 Installation progressAfter the installation is complete, click Next.Figure 6 Installation is completeSelect Launch the MySQL Instance Configuration Wizard and click Finish.MySQL client installationIf an iMC server uses a separate database, you must install the MySQL client program on the iMC server.When you configure the database for iMC on the iMC deployment wizard, select Other server for Database location and enter the database server IP address.Before installing the MySQL client, obtain the MySQL installation program that is applicable to the Windows operating system. This document takes mysql-5.5.5-win32.msi installation program for example. Double click the program to start the setup wizard.Figure 7MySQL server setup wizardClick Next.Figure 8 License agreement pageSelect I accept the terms in the License Agreement and click Next. Figure 9 Select setup typeClick Customto customize installed components and installation path.Figure 10 Customize the installationSelect MySQL Server > Client Programs . To change the installation path, click Browse . Click Next.Figure 11 Ready to install the MySQL clientClick Install to install the MySQL client to the host. Figure 12 Installation progressAfter the installation is complete, click Next. Figure 13 Installation is completeDo not select Launch the MySQL Instance Configuration Wizard and click Finish.ConfigurationConfiguring the MySQL server instanceYou must configure the instance for the MySQL server but not for the MySQL client. You can continue to configure the MySQL server upon finishing the installation, or you can open the MySQL server configuration wizard by selecting Start > All Programs > MySQL 5.5 > MySQL Server Instance Configuration Wizard.Open the MySQL Server Instance Configuration Wizard page.Figure 14MySQL server instance configuration wizardClick Next.Figure 15 Select a configuration typeSelect Detailed Configuration and click Next. Figure 16 Select a server typeSelect Server Machine and click Next.Figure 17 Select the database usageSelect Transactional Database Only and click Next. Figure 18 Choose the directory for the databaseSet the directory for installing the database and click Next.Figure 19 Set the number of concurrent connections to the MySQL serverSelect Manual Setting and type 200 (recommended) for Concurrent connections . Click Next. Figure 20 Set the networking optionsSet the port number to 3306 and select Add firewall exception for this port . Click Next.Figure 21 Select the default character setSelect Manual Selected Default Character Set/Collation and set the character set according to the language of your operating system, for example, latin1 for English. Click Next. Figure 22 Set the Windows optionsSelect Install As Windows Service, and type a name for the service name, MySQL in this example. Select Include Bin Directory in Windows PATH, and click Next.Figure 23Set the security optionsSelect Modify Security Settings, set the root password, and select Enable root access from remote machines. Click Next.IMPORTANT:For iMC to correctly identify the root user password during installation, make sure that the password does not contain any of the following characters:` ' \ " ! ( ) & | \\ $ ; @ < > / ^ \t.If you do not want to change the password of the root user, create a user with root user privileges and make sure that the password does not contain any of the previous characters. For more information about creating a database user, see “Creating a database user.”Figure 24Ready to execute the settingsClick Execute to execute the MySQL server instance settings. Figure 25Configuration is completeClick Finish to complete the MySQL server instance configuration.Configure the privilege settings for the remote root user with the following commands:mysql –uroot –pmysqlgrant all privileges on *.* to root@’%’ identified by ‘mysql’ with grant option; mysql is the password for user root.Figure 26Configure the privilege settings for the remote root userThen configure the max_allowed_packet size.1.Open file my.ini in the MySQL installation path.Figure 27Configuration file path2.Add the max_allowed_packet parameter under [mysqld]. If the parameter already exists, youcan change its value.[mysqld]max_allowed_packet = 200M3.Save the changes and restart MySQL.Creating a database userYou can create new users rather than use the default user (root user) and grant them privileges to manage and operate the database.CAUTION:You can create a user on the MySQL server but not on the MySQL client.Creat a database user and grant privileges to the user with the following commands:mysql -uroot -pmysqlgrant all privileges on *.* to roottest@’%’ identified by ‘passwordtest’ with grant option;mysql is the password of the root user and passwordtest is the password of the new user roottest.Figure 28Add a database userStartup and StopOpen the Windows service management page on the MySQL server to start or stop the MySQL service.Figure 29Start or stop MySQL serviceUninstallationTo uninstall the MySQL server from the Windows operating system, remove the MySQL server instance first. You can uninstall the MySQL client from the Windows operating system directly. Removing the MySQL server instanceSelect Start > All Programs > MySQL 5.5 > MySQL Server Instance Configuration Wizard to enter the MySQL server instance configuration wizard page.Figure 30MySQL server instance configuration wizardClick Next.Figure 31 Select a maintenance optionSelect Remove Instance and click Next. Figure 32 Remove the instanceClick Execute to remove the instance.Figure 33Instance is removedUninstalling the MySQL serverSelect Control Panel > Add or Remove Programs to enter the Add or Remove Programs page where you can uninstall the MySQL server.Figure 34Uninstall the MySQL server from WindowsFAQGarbled Characters Appear in the Database TableCorrectly set the character set when you install the MySQL server. If not, garbled characters appear inthe database table. Table 1 describes the character sets for different languages. For instruction on howto set the character set, see Figure 21.Table 1Character sets for different languagesset Language CharacterEnglish latin1Japanese sjisHow can I update database passwords for iMC?The usernames and passwords used by the iMC modules are stored in cipher text in file\common\conf\ server-addr.xml in the installation path. You can use the pwdmgr.bat command toobtain passwords in clear text or update the latest passwords to the file.Usually, a user can use the database management tool to change the database password of a certainiMC module. To ensure communication between iMC and the database, use the pwdmgr.bat commandto update the corresponding password in file server-addr.xml. If iMC is deployed in distributed mode,you must update the password for every iMC server, as shown in Figure 35.Figure 35Update database passwords for iMCIn the preceding commands, dbpasswd represents the latest database password of the user imc_config,config_db represents the database name, and 192.168.20.107 represents the IP address of the database.To obtain the IP address and name of a MySQL database, view the settings of the corresponding user infile $IMCROOT/common/conf/server-addr.xml.21。
实验指导书《数据库原理》编者:吕泽华华中科技大学软件学院课程编号课程名称(中文)数据库原理及应用课程名称(英文) Database Principle and Application课程属性专业课适用专业软件工程先修课程要求计算机导论、程序设计基础、数据结构等总学时 64学时总学分 4分实验学时 16学时实验学分应开实验学期三年级第一学期教材及实验指导书名称:自编的实验指导书一、课程简介及基本要求本课程从基本原理和应用实例两方面全面地介绍关系型数据库系统,使学生能够在熟悉数据库系统基本操作及应用的同时,具备基本的应用系统开发的技能,为将来从事工作打下良好的基础。
二、实验课程目的与要求本实验课程可以使学生在理论学习之后,对课程内容有一个直观的了解;并通过实际操作掌握数据库应用系统开发的各种技能。
本实验课程要求学生达到如下基本要求:1、掌握MySQL5.0的基本情况和基本使用方法。
2、掌握MySQL5.0中各级基本数据库对象的管理,包括(1) 数据库的创建和各种基本管理操作。
(2) 数据表格的创建和各种基本管理操作。
(3) 表格数据的编辑和维护。
(4) 表格数据的各种查询操作。
(5) 有关视图的操作。
3、熟悉MySQL5.0中数据库完整性的实现。
4、了解MySQL5.0中数据库安全性的实现。
5、熟悉MySQL5.0中数据库的备份和恢复。
三、主要仪器设备本实验课程要求的主要仪器设备是计算机。
四、实验方式与基本要求本实验课程以学生实际上机操作为主,教师在课堂教学时进行演示。
五、考核与报告因为本实验课程是非独立设课,故其考核方式与相关课程一样,采用考试的考核方式。
实验教学部分的成绩在课程总成绩中占一定的比例。
六、实验项目设置与内容实验一熟悉MySQL的安装、使用环境及其基本工具的使用实验学时:0.5学时实验类型:验证实验要求:必做一、实验目的熟悉MySQL的安装和用法环境。
掌握MySQL管理工具Navicat的使用。
mysql5.0安装使用教程手册描述:mysql5.0安装mysql5.0教程mysql5.0的安装mysql5.0使用教程mysql5.0安装手册双击Setup.exe文件,开始mysql5.0的安装。
出现下面的窗口点击Next开始下一步安装。
默认是Typical,建议改成Custom,因为Typical模式不允许改变安装路径,只能安装在C盘。
之后这里需要选择组件和更改文件夹位置,组件可以默认的,位置要选择Change来改变接下看..注意:安装mysql的路径中,不能含有中文!如果没有需要更改的话,,那点击Install开始安装吧~~。
如下是[安装过程],您能看到安装进度条...待待吧..当安装完成时,您便能看到下面的[注册]了。
当然,我们选择[跳过],即[SkipSign-Up]。
之后点“Next”进行再如下面。
点击Finish继续现在开始配置的工作了。
点击Next继续选择Detailed Configuration,点Next继续下面这个选项是选择mysql应用于哪种类型,(第一种是开发服务器,将只用尽量少的内存,第二种是普通WEB服务器,将使用中等数量内存,最后一种是这台服务器上面只跑mysql 数据库,将占用全部的内存,)这里示例选择开发服务器,占用尽量少的内存,用户可根据自己的需求,选择其他选项,点Next继续下面是选择数据库用途,(第一种是多功能用途,将把数据库优化成很好的innodb存储类型和高效率的myisam存储类型,第二种是只用于事务处理类型,最好的优化innodb,但同时也支持myisam,最后一种是非事务处理类型,适合于简单的应用,只有不支持事务的myisam类型是被支持的。
)一般选择第一种多功能。
点Next继续,下面是选择InnodDB的数据存放位置,一般默认好了,不需要改动下面是选择mysql允许的最大连接数,第一种是最大20个连接并发数,第二种是最大500个并发连接数,最后一种是自定义,你可以根据自己的需要选择点Next继续,下面是选择数据库监听的端口,一般默认是3306,如果改成其他端口,以后连接数据库的时候都要记住修改的端口,否则不能连接mysql数据库,比较麻烦,这里不做修改,用mysq的默认端口:3306点Next继续,这一步设置mysql的默认编码,默认是latin1这里可以根据需要,把它改成gb2312,过gbk注意:如果要用原来数据库的数据,最好能确定原来数据库用的是什么编码,如果这里设置的编码和原来数据库数据的编码不一致,在使用的时候可能会出现乱码。
1.点击next2.选择用户自定义安装3.注意在默认情况下点击Developer Components选项(默认为叉叉)。
选择第二项。
并选择安装目录。
点击next4.点击安装5.选择第三个,这个是关于官网注册什么云云的。
直接跳过。
点击next6.到此安装完毕---点击finish开始配置mysql7.点击next8.选择第一项。
按细节方式配置点击next9.选择第一项程序员开发模式点击next10.选择第一个选项点next11.点击next12.这里选择第三项填入并发访问的用户数作为独立开发填小一点就ok了。
13.这里默认的就ok了。
Mysql服务端口一般都为3306 点击next14.配置字符集当选择第一个时,中文就无法使用。
因为我们要用utf8的编码。
所以选择第二个或者选择第三个选择utf8字符集。
点击next 点击nextStandard Character Set:Latin1为默认的字符集。
主要用于西方欧洲国家的语言。
Best Support For Multilingualism:UTF8为默认的字符集。
Manual Selected Default Character Set / Collation:个人设定。
(如果你希望数据库支持汉字,请选择gb2312)。
选择缺省的“Standard Character Set”,下一步(Next)。
15.启动方式。
这里两个都选第一个表示启动windows时就启动mysql服务。
第二个表示可以通过dos命令窗口启动mysql。
点击next16.设置管理员密码,允许其他机器也可以访问本机mysql数据库(在密码下面的框框打钩)。
点击next17.点击执行,当全部都正确时,表示配置成功。
若有失败的。
停掉mysql服务。
删除安装文件夹,重新安装。
18.点击finish安装完成。
测试一下:在dos环境中输入mysql –uroot –proot 回车出现如上图表示正确安装。
MySQL Server 5.0 安装图文教程减小字体 增大字体/wenzhang124.html下文中的图解安装步骤是按照自己的用途(一般小型系统开发)来定制的,针对不同的用途,参数的设置 会有相应调整。
运行MySQL Server 5.0安装程序“setup.exe”,出现如下界面:安装向导启动,按“Next”继续:选择安装类型,为了方便熟悉安装过程,我们选择“Custom”。
按“Next”继续:在“Developer Components”上左键单击,选择“This feature, and all subfeatures, will be installed on local hard drive.”,以保证安装所有文件。
点选“Change...”,手动指定安装目录。
按“Next”继续:确认一下先前的设置。
按“Install”开始安装:正在安装中,请稍后...出现该界面,直接按“Next”继续:直接按“Next”继续:至此,软件安装完成。
勾选“Configure the Mysql Server now”,按“Finish”结束软件的安装并启动 MySQL Server配置向导。
按“Next”继续:选择配置方式,“Detailed Configuration”、“Standard Configuration”,选择“Detailed Configuration”,方便熟悉配置过程。
选择服务器类型,“Developer Machine(开发测试类,MySQL占用很少资源)”、“Server Machine(服 务器类型,MySQL占用较多资源)”、“Dedicated MySQL Server Machine(专门的数据库服务器, MySQL占用所有可用资源)”,一般选“Server Machine”,不会太少,也不会占满。
按“Next”继续:选择mysql数据库的大致用途,“Multifunctional Database(通用多功能型,好)”、“Transactional Database Only(服务器类型,专注于事务处理,一般)”、“NonTransactional Database Only(非 事务处理型, 较简单, 主要做一些监控、 记数用, 对MyISAM数据类型的支持仅限于nontransactional), 随自己的用途而选择了,我这里选择“Transactional Database Only”,按“Next”继续:对InnoDB Tablespace进行配置,就是为InnoDB 数据库文件选择一个存储空间,如果修改了,要记 住位置,重装的时候要选择一样的地方,否则可能会造成数据库损坏,当然,对数据库做个备份就没问题 了。
MySQL5.0安装图解打开下载的mysql安装文件mysql-5.0.27-win32.zip,双击解压缩,运行“setup.exe”,出现如下界面:按“Next”继续选择安装类型,有“Typical(默认)”、“Complete(完全)”、“Custom(用户自定义)”三个选项,我们选择“Custom”,有更多的选项,也方便熟悉安装过程在“Developer Components(开发者部分)”上左键单击,选择“This feature, and all subfeatures, will be installed on local hard drive.”,即“此部分,及下属子部分内容,全部安装在本地硬盘上”。
在上面的“MySQL Server(mysql服务器)”、“Client Programs (mysql客户端程序)”、“Documentation(文档)”也如此操作,以保证安装所有文件。
点选“Change...”,手动指定安装目录。
填上安装目录,我的是“F:\Server\MySQL\MySQL Server 5.0”,也建议不要放在与操作系统同一分区,这样可以防止系统备份还原的时候,数据被清空。
按“OK”继续。
返回刚才的界面,按“Next”继续。
确认一下先前的设置,如果有误,按“Back”返回重做。
按“Install”开始安装。
正在安装中,请稍候,直到出现下面的界面这里是询问你是否要注册一个的账号,或是使用已有的账号登陆,一般不需要了,点选“Skip Sign-Up”,按“Next”略过此步骤。
现在软件安装完成了,出现上面的界面,这里有一个很好的功能,mysql配置向导,不用向以前一样,自己手动乱七八糟的配置my.ini 了,将“Configure the Mysql Server now”前面的勾打上,点“Finish”结束软件的安装并启动mysql配置向导。
mysql配置向导启动界面,按“Next”继续。
Linux下MySQL5.0的安装在SUSE9下MySQL5.0的安装及配置过程,由于是使用的源码包安装,该过程应该同样适用于其它版本的Linu x。
一、安装MySQL1、下载源码包从mysql官网上下载linux下的source包mysql-5.0.51b.tar.gz,注意是下载GNU tar格式的,不是rpm包。
2、解包tar xvf mysql-5.0.51b.tar.gz3、进入mysql目录cd mysql-5.0.51b4、安装./configure --prefix=/opt/cuix/ mysql-5.0.51 指定mysql的安装目录--with-charset=utf8 指定字符集--with-collation=utf8_general_cimakemake install二、配置MySQL1、初始化数据库执行scripts/mysql_install_db,初始化mysql数据库的授权表,其中贮存了服务器的访问允许,该操作将会在mysql安装目录下创建var目录。
2、设置PATH为了方便使用,将mysql-5.0.51/bin目录加入到当前用户的profile中,然后用which mysql检查一下是否ok.3、设置f配置文件在support-files目录下有三个预设置的文件可供选择,选择一个适合你的,我这里选择的是f,复制这个文件到你的安装目录下:cp support-files/f /opt/cuix/mysql-5.0.51/f注意f的使用方法,这个配置文件的路径可以在启动mysql时通过命令行参数给出,比如:./mysqld_safe --defaults-file=f &4、赋予my.conf权限chmod 744 f5、修改my.conf文件查找[client]:添加user=root,去掉password前的注释并设定root账户的密码,设定port,使用netstat –atln | grep “端口号”查看你自己的端口是否被占用,更改socket,默认/tmp/mysql.sock可能和其他的mysql服务器冲突,修改到当前mysql安装目录下。
MySQL数据库的搭建版本1.0JAVA课程组2009年7月修改记录目录MYSQL数据库的搭建 (1)版本1.0 (1)JAVA课程组 (1)一、MYSQL概述 (4)二、选择MYSQL安装版本 (4)三、MYSQL服务的安装 (4)3.1 解压缩 (4)3.2 配置文件 (4)3.3 安装服务 (5)3.4 启动服务 (5)四、使用命令行客户端连接MYSQL数据库 (6)五、设置密码 (6)六、使用图形化客户端工具 (7)6.1 register database (7)6.2 create database (10)一、MySQL概述Mysql是一个开源的关系数据库管理系统,它体积小,速度快,而且是开源的,目前被广泛应用在中小型网站。
二、选择MySQL安装版本MySQL支持多种操作系统平台,我们以微软Windows版本作为示例,并且为了更好的了解MySQL,我们选择压缩版的安装包,可以从MySQL的官方网站()下载最新版本,在学院的FTP上也有一个我们教学过程中使用的版本,地址是:ftp:///Java/software/tools/。
三、MySQL服务的安装3.1 解压缩将下载的mysql服务器安装包mysql-noinstall-5.0.77-win32.zip解压到你选择的目录(本例中我还是放在E盘的根目录下面)。
3.2 配置文件进入到解压的目录下,看到里面有5个配置文件,分别是:my-small.ini、my-medium.ini、my-large.ini 、my-huge.ini、my-innodb-heavy-4G.ini。
这些都是官方给出的经过优化的配置文件,我们可以根据自己系统的需要选择一个:●my-small.ini 小型负载的配置(内存<=64M)●my-medium.ini 中型负载的配置(内存<=128M)●my-large.ini 负载比较大的配置(内存=512M)●my-huge.ini巨大负载的配置(1G<=内存<=2G)●my-innodb_heavy_4G.ini 高负荷大型事务的配置(内存>=4G)在这里我们选择使用my-small.ini作为我们的配置文件。
MySQL数据库技术与实验指导(第1版)钱雪忠、王燕玲、张平编著清华大学出版社2011.09实验1 数据库系统基础操作进入MySQL的官方下载页面:/downloads/如果想找旧的发布版本,可进入页面:/archives.php例1-1 有一个脚本文件(test.sql),文件内容:Show databases;Create database test;Use test;Create table table_1( I int ) ENGINE = MyISAM;执行之。
解:C:\> mysql -h localhost -u root -p <c:\test.sql或mysql> source c:\test.sql实验2 MySQL数据库基础操作例2-1 创建jxgl数据库。
解:mysql>create database jxgl;例2-2 查看本机服务器上数据库。
解:mysql>show databases;或:mysql>show databases like 'my%';例2-3 进入jxgl数据库。
解:mysql> USE jxgl;例2-4 在命令行环境中,创建和删除数据库jxgl:解:创建数据库:C:\> mysqladmin -h localhost -u root -p create jxgl删除数据库:C:\> mysqladmin -h localhost -u root -p drop jxgl实验3 表、ER图、索引与视图的基础操作CREATE TABLE IF NOT EXISTS `jxgl`.`sc`(`sno` CHAR(7) NOT NULL ,`cno` CHAR(2) NOT NULL ,`grade` INT NULL ,PRIMARY KEY (`sno`,`cno`),INDEX `sc_ibfk_1`(`sno` ASC),INDEX `sc_ibfk_2`(`cno` ASC) , CONSTRAINT `sc_ibfk_1` FOREIGN KEY(`sno`) REFERENCES `jxgl`.`student`(`sno`) ON DELETE RESTRICT ON UPDATE RESTRICT,CONSTRAINT `sc_ibfk_2` FOREIGN KEY(`cno`) REFERENCES `jxgl`.`course` (`cno`) ON DELETE RESTRICT ON UPDATE RESTRICT) ENGINE = InnoDB;例3-1 列出jxgl数据库中所有表。