windows下PHP5與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。
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章