windows下PHP5与Mysql的搭建

本文介绍了如何在Windows系统下安装和配置MySQL的免安装版,包括设置环境变量、修改my.ini文件以及启动MySQL服务。同时,文章还详细讲解了PHP配置过程,主要是修改php.ini文件启用相关MySQL扩展,确保PHP能支持MySQL连接。
MySQL是一个关系型数据库管理系统,分为MySQL Enterprise Edition(commercial)、MySQL Cluster CGE、MySQL Community Edition三个版本,第一个 MySQL Enterprise Edition需要花钱,提供技术支持。第二个 MySQL Cluster,要在MySQL Enterprise Edition或MySQL Community Edition的基础上用,平衡多台数据库。第三个MySQL Community Server,这个免费,接下来我们就来安装它,安装包有两种格式,一个是msi格式(安装版),一个是zip格式(免安装,需要配置一下直接可以用)。
Mysql免安装版的配置
1.配置环境变量
在系统环境变量Path中添加MYSQL主目录下的bin的路径
2.修改my.ini文件
在mysql主目录下有一个my-default.ini,修改如下内容,并修改重命名为my.ini。
添加如下内容,
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html 
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
 # *** upgrade to a newer version of MySQL. 
[client]
 default-character-set=utf8 
port=3306 [mysqld]
 # Remove leading
 # and set to the amount of RAM for the most important data
 # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
 innodb_buffer_pool_size = 128M
 # Remove leading
 # to turn on a very important data integrity option: logging
 # changes to the binary log between backups. 
log_bin
 # These are commonly set, remove the # and set as required. 
basedir = G:\MZC\mysql-5.6.24-win32 
datadir = G:\MZC\mysql-5.6.24-win32\data 
port = 3306 
# server_id = ..... 
character_set_server = utf8 
 # Remove leading 
# to set options mainly useful for reporting servers. 
# The server defaults are faster for transactions and fast SELECTs. 
# Adjust sizes as needed, experiment to find the optimal values. 
# join_buffer_size = 128M 
# sort_buffer_size = 2M 
# read_rnd_buffer_size = 2M 
 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
 [WinMySQLAdmin] 
G:\MZC\mysql-5.6.24-win32\bin\mysqld.exe
3.启动mysql
以管理员身份运行cmd,输入mysqld -install,至此,mysql的安装就成功了,我们也可以在服务管理里找到mysql
注意事项:my.ini文件的编码必须是英文编码(如windows中的ANSI),不能是UTF-8或GBK等

PHP的配置
1.修改PHP目录下的php.ini
确保,extension_dir前面的;号去掉,并且填写的路径为PHP目录下的ext文件夹,然后找到下面的extension扩展项,把以下扩展前的;号给去掉,php_mbstring.dll、php_mysql.dll、php_mysqli.dll。至此,PHP对mysql的支持就完成了。
额外内容:
在php.ini中,找到date.timezone一项,填写时区,可以填写为date.timezone = PRC。
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值