httpd-2.4.20-x64-vc14-r2.zip
php-7.0.8-Win32-VC14-x64.zip
mysql-5.7.13-winx64.zip
phpMyAdmin-4.6.3-all-languages.zip
解压httpd-2.4.20-x64-vc14-r2.zip到D:\php\httpd-2.4.20-x64-vc14-r2
解压php-7.0.8-Win32-VC14-x64.zip到D:\php\php-7.0.8-Win32-VC14-x64
解压mysql-5.7.13-winx64.zip到D:\php\mysql-5.7.13-winx64
解压phpMyAdmin-4.6.3-all-languages.zip到D:\php\httpd-2.4.20-x64-vc14-r2\Apache24\htdocs\phpMyAdmin
(以下步骤中所指行号仅限于所指版本)
修改D:\php\httpd-2.4.20-x64-vc14-r2\Apache24\conf\httpd.conf文件
38行,
Define SRVROOT "/Apache24"
ServerRoot "${SRVROOT}"
改为
Define SRVROOT "D:/php/httpd-2.4.20-x64-vc14-r2/Apache24"
ServerRoot "${SRVROOT}"
279行,
<IfModule dir_module>
DirectoryIndex index.html
IfModule>
改为
<IfModule dir_module>
DirectoryIndex index.html index.php
IfModule>
530行,
加入php支持
# php7 support
LoadModule php7_module "D:/php/php-7.0.8-Win32-VC14-x64/php7apache2_4.dll"
AddType application/x-httpd-php .php
PHPIniDir "D:/php/php-7.0.8-Win32-VC14-x64"
管理Apache服务
安装服务
httpd.exe -k install
卸载服务
httpd.exe -k uninstall
启动服务
net start Apache2.4
停止服务
net stop Apache2.4
其它命令参考:Running Apache as a Service
拷贝D:\php\php-7.0.8-Win32-VC14-x64\php.ini-development至同一目录并重命名为php.ini,修改该文件
724行,
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
; extension_dir = "ext"
改为
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
extension_dir = "ext"
876和878行,
;extension=php_ldap.dll
;extension=php_mbstring.dll
;extension=php_exif.dll ; Must be after mbstring as it depends on it
;extension=php_mysqli.dll
改为
;extension=php_ldap.dll
extension=php_mbstring.dll
;extension=php_exif.dll ; Must be after mbstring as it depends on it
extension=php_mysqli.dll
注意:724行的修改,参见下一节补充,此处需将D:\php\php-7.0.8-Win32-VC14-x64目录加入系统环境变量Path
拷贝D:\php\mysql-5.7.13-winx64\my-default.ini至同一目录并重命名为my.ini,修改该文件
17行,
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
改为
# These are commonly set, remove the # and set as required.
basedir = D:/php/mysql-5.7.13-winx64
datadir = D:/php/mysql-5.7.13-winx64/data
port = 3306
# server_id = .....
33行,
加入字符集设置
character_set_server = utf8
初始化D:\php\mysql-5.7.13-winx64\data目录(这里会生成root的临时密码)
mysqld --initialize --console
管理MySQL服务
安装服务
mysqld --install
卸载服务
mysqld --remove
启动服务
net start MySQL
停止服务
net end MySQL
修改密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
其他命令参考:Server Command Options
D:\php\httpd-2.4.20-x64-vc14-r2\Apache24\conf\httpd.conf文件
60行,
#Listen 12.34.56.78:80
Listen 80
端口不需要修改,如遇到服务无法启动,可能是端口冲突引起,如PC安装了Skype,需至Skype“工具->选项->高级->连接”,取消勾选“将端口80与端口443用于其他接入连接”
D:\php\php-7.0.8-Win32-VC14-x64\php.ini
798行,
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 2M
使用phpMyAdmin导入文件时,文件最大限制为2,048KB,可修改此处以便上传较大文件
D:\php\mysql-5.7.13-winx64\my.ini
33行,
character_set_server = utf8
只需指定character_set_server就可(注意是下划线),不需要指定default-character-set = utf8(没有这个属性设定),使用SHOW VARIABLES LIKE ‘character%’;查看当前设置的字符编码
7.3.1 User Names and Passwords
The MySQL installation process populates the grant tables with an initial root account, as described in Section 2.10.4, “Securing the Initial MySQL Accounts”, which also discusses how to assign passwords to it. Thereafter, you normally set up, modify, and remove MySQL accounts using statements such as CREATE USER, DROP USER, GRANT, and REVOKE. See Section 14.7.1, “Account Management Statements”.
2.10.1.1 Initializing the Data Directory Manually Using mysqld
To initialize the data directory, invoke mysqld with the –initialize or –initialize-insecure option, depending on whether you want the server to generate a random initial password for the ‘root’@’localhost’ account.
2.10.4 Securing the Initial MySQL Accounts
Passwords may have already been assigned under these circumstances:
Installation On Windows performed using MySQL Installer give you the option of assigning passwords.
Installation on Linux using a server RPM or Debian distribution from Oracle, if you have followed the instructions given in Section 2.5.5, “Installing MySQL on Linux Using RPM Packages from Oracle”, Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository”, Section 2.5.6, “Installing MySQL on Linux Using Debian Packages from Oracle”, or Section 2.5.3, “Installing MySQL on Linux Using the MySQL APT Repository”.
As of MySQL 5.7.6, if you initialized the data directory manually using mysqld –initialize and followed the instructions in Section 2.10.1.1, “Initializing the Data Directory Manually Using mysqld”, you should have assigned a password to the initial account.
7.3.6 Password Expiration Policy
From MySQL 5.7.4 to 5.7.10, the default default_password_lifetime value is 360 (passwords must be changed approximately once per year). For those versions, be aware that, if you make no changes to the default_password_lifetime variable or to individual user accounts, all user passwords will expire after 360 days, and all user accounts will start running in restricted mode when this happens. Clients (which are effectively users) connecting to the server will then get an error indicating that the password must be changed: ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.