




已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
MySQL在Windows下的免安装配置文章分类:Java编程 1、软件的下载 到mysql的官方网站下载MySQL的解压包,mysql-noinstall-5.0.22-win32.zip 然后解压到C:mysql里面就是MySQL数据库的全部内容。 2、配置 首先我们来看MySQL的根目录,里面有多个文件名如my-*.ini形式的文件,这就是MySQL配置 的样例文件,你可以选取其中一个,将其名字改为my.ini,MySQL启动的时候就是读取这个my.ini文 件来决定数据库的各项参数。 在my.ini文件中需要进行配置的主要是两个方面,一个是客户端,一个是服务器端。 * 客户端配置 # CLIENT SECTION #- client port = 3306 mysql default-character-set = gbk 需要配置的主要是两项,一个是客户端端口,一个是默认的字符集(gbk就是设置成了中文),这 里端口选用默认的3306,字符集可以根据需要修改为UTF-8或GBK。 * 服务器端配置 #SERVER SECTION #- mysqld port = 3306 basedir = C:/mysql-5.0.51b-win32 datadir = C:/mysql-5.0.51b-win32/Data default-character-set = gbk default-storage-engine = INNODB max_connections = 100 max_allowed_packet = 16M 这里主要的是端口port,数据库安装目录(也就是我们解压的目录)basedir,数据库中数据 的存储路径(也就是你将来建立的Database和Table存放的位置)datadir。 其次就是字符集的设置,最大连接数的设置等,实际的设置项要根据开发与使用的需要,参 考解压目录中的几个样例文件进行取舍配置。 3、启动Mysql数据库 * 可以在Windows环境变量的path中先加入C:mysqlbin这项,这样我们就可以 在命令行中直接使用mysql的各项命令了 * 进入命令行窗口,运行c:mysqld-nt,这是查看Windows任务管理器,发现进程中多出来一个 mysqld-nt.exe,这说明数据库已经成功的启动的了。 * 此外,我们可以把数据库注册成一个服务,随着系统的启动而启动,具体命令如下: c:mysqld-nt -install 运行上面的命令后,就会在系统服务中注册了一个名字为MySQL,启动来性为Automatic的服务 ,这个服务默认情况下是自动启动的。 可以通过命令行的防止停止或启动,如: c:net start MySQL启动) c:net stop MySQL(停止) c:mysqld-nt -remove MySQL(卸载服务) 4、使用MySQL数据库 * 由于我们在环境变量的path中加入了MySQL安装目录下的bin这项,所以可以直接使用MySQL命 令。 * 配置好上面信息并启动MySQL以后,默认的用户名root,密码为空,所以我们可以使用一下命 令登陆数据库: c:mysql -uroot -hlocalhost 回车以后会看到如下命令行状态: mysql 这说明已经成功登陆了MySQL数据库。 如果想为root用户加上密码,可以退出数据库mysqlquit,然后使用如下命令设置root用户的 密码: c:mysqladmin -uroot password 123456 这样就将root用户的密码修改为123456了,再次登陆数据库是就要用如下代码: c:mysql -uroot -p123456 -hlocalhost 至此,MySQL5数据库的配置就完成了,可以通过客户端或是程序来使用这个数据库了。 5、总结 MySQL提供了Install和NotInstall两种文件包的下载和安装方式,Install方式使用起来更为直 观和方便,而notInstall方式则能让你更加的了解MySQL数据库基本配置内容,所以各有利弊。从个 人角度来看,还是比较推荐notIntall的方式来使用Mhysql数据库,这样可以为在不同的平台下使用 MySQL奠定一个良好的基础。 现用my.ini 根据my-huge.ini改 # Example MySQL config file for very large systems. # # This is for a large system with memory of 1G-2G where the system runs mainly # MySQL. # # You can copy this file to # /etc/f to set global options, # mysql-data-dir/f to set server-specific options (in this # installation this directory is /usr/local/var) or # /.f to set user-specific options. # # In this file, you can use all long options that a program supports. # If you want to know which options a program supports, run the program # with the -help option. # The following options will be passed to all MySQL clients client #password = your_password port = 3306 socket = /tmp/mysql.sock # Here follows entries for some specific programs # The MySQL server mysqld port = 3306 socket = /tmp/mysql.sock skip-locking key_buffer = 384M max_allowed_packet = 1M table_cache = 512 sort_buffer_size = 2M read_buffer_size = 2M read_rnd_buffer_size = 8M myisam_sort_buffer_size = 64M thread_cache_size = 8 query_cache_size = 32M # Try number of CPUs*2 for thread_concurrency thread_concurrency = 8 basedir= C:mysql #bind-address= datadir= C:mysql/data #language=C:mysql/share/english #slow query log#= #tmpdir#= #port=3306 #set-variable=key_buffer=16M WinMySQLadmin Server=C:mysql/bin/mysqld-nt.exe user=root password=mysql # Dont listen on a TCP/IP port at all. This can be a security enhancement, # if all processes that need to connect to mysqld run on the same host. # All interaction with mysqld must be made via Unix sockets or named pipes. # Note that using this option without enabling named pipes on Windows # (via the enable-named-pipe option) will render mysqld useless! # #skip-networking # Replication Master Server (default) # binary logging is required for replication log-bin=mysql-bin # required unique id between 1 and 232 - 1 # defaults to 1 if master-host is not set # but will not function as a master if omitted server-id = 1 # Replication Slave (comment out master section to use this) # # To configure this host as a replication slave, you can choose between # two methods : # # 1) Use the CHANGE MASTER TO command (fully described in our manual) - # the syntax is: # # CHANGE MASTER TO MASTER_HOST=, MASTER_PORT=, # MASTER_USER=, MASTER_PASSWORD= ; # # where you replace , , by quoted strings and # by the masters port number (3306 by default). # # Example: # # CHANGE MASTER TO MASTER_HOST=125.564.12.1, MASTER_PORT=3306, # MASTER_USER=joe, MASTER_PASSWORD=secret; # # OR # # 2) Set the variables below. However, in case you choose this method, then # start replication for the first time (even unsuccessfully, for example # if you mistyped the password in master-password and the slave fails to # connect), the slave will create a file, and any later # change in this file to the variables values below will be ignored and # overridden by the content of the file, unless you shutdown # the slave server, delete and restart the slaver server. # For that reason, you may want to leave the lines below untouched # (commented) and instead use CHANGE MASTER TO (see above) # # required unique id between 2 and 232 - 1 # (and different from the master) # defaults to 2 if master-host is set # but will not function as a slave if omitted #server-id = 2 # # The replication master for this slave - required #master-host = # # The username the slave will use for authentication when connecting # to the master - required #master-user = # # The password the slave will authenticate with when connecting to # the master - required #master-password = # # The port the master is listening on. # optional - defaults to 3306 #master-port = # # binary logging - not required for slaves, but recommended #log-bin=mysql-bin # Point the following paths to different dedicated disks #tmpdir = /tmp/ #log-update = /path-to-dedicated-directory/hostname # Uncomment the following if you are using BDB tables #bdb_cache_size = 384M #bdb_max_lock = 100000 # Uncomment the following if you are using InnoDB tables #innodb_data_home_dir = /usr/local/var/ #innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend #innodb_log_group_home_dir = /usr/local/var/ #innodb_log_arch_dir = /usr/local/var/ # You can set ._buffer_p
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 3.1.3食物的消化和营养物质的吸收说课稿-2024-2025学年冀少版(2024)生物七年级下册
- 工地监护员考试题及答案
- 2025宝马购车合同样本
- 服务人民考试题目及答案
- 肥城医院考试题目及答案
- 乡镇燃气一体化工程技术方案
- 大数据在建筑施工过程中的成本控制机制
- BIM技术在建筑质量监控与检测中的应用创新
- 中职音乐基础试题及答案
- 基础安全知识试题及答案
- 0.4mm隔潮膜报告及首页20230605
- 用Excel编写公式模板计算医学决定水平处的偏倚
- ISO 14067-2018:温室气体 产品碳足迹 量化要求和指南(中文版)
- 2024年度吉林省高校教师资格证之高等教育心理学考试题库
- 教育综合统计调查制度培训课件2023年修订
- 智能城市垃圾分类处理系统合同
- 乙酰丙酸论文
- 人教版 九年级历史上册 第一、二单元 单元测试卷(2024年秋)
- 偏瘫康复护理个案病例分析
- NBT 10643-2021 风电场用静止无功发生器技术要求与试验方法-PDF解密
- 铁路防雷及接地工程技术规范(TB 10180-2016)
评论
0/150
提交评论