apache php mysql安装升级

下载

https://windows.php.net/download/

php-8.0.12-nts-Win32-vs16-x64.zip

apache下载

https://www.apachelounge.com/

httpd-2.4.51-win64-VS16.zip

https://www.mysql.com/downloads/

MySQL Community (GPL) Downloads  -->https://dev.mysql.com/downloads/

MySQL Community Server  -->https://dev.mysql.com/downloads/mysql/

(mysql-8. 0.27-winx64.zip)

导出原有数据库

不指定编码,导入的时候会有Unknown command '\'' 错误提示导致失败---导入时指定编码

mysqldump.exe --default-character-set=utf8mb4 -u root -p tmk > e:\wz\bf0909.sql

------------------------------------------

mysqldump.exe 默认参数从以下文件读取,按此顺序寻找配置文件:

C:\Windows\my.ini

C:\Windows\my.cnf

C:\my.ini

C:\my.cnf

E:\wz\mysql-8.0.17-winx64\mysql-8.0.17-winx64\my.ini

E:\wz\mysql-8.0.17-winx64\mysql-8.0.17-winx64\my.cnf

------------------------------------------

从服务器导出--Database Manager--Management--Download in SQL Format

停止服务删除数据库

sc stop mysql

sc delete mysql

设置path

E:\wz\httpd-2.4.51-win64-VS16\Apache24\bin;

E:\wz\mysql-8.0.27-winx64\mysql-8.0.26-winx64\bin;

E:\wz\php-8.0.12-nts-Win32-vs16-x64;

E:\wz\php-8.0.12-nts-Win32-vs16-x64\ext;

数据服务启动

mysqld.exe -install

mysqld.exe --initialize

net start mysql

下一步登录需要密码,临时密码 data/***.err 文件中,在文件中找到

A temporary password is generated for root@localhost: r,WD2XewrwN.

其中 r,WD2XewrwN. 就是密码,所有字符,从r到. 12个字符

mysql -u root -p        登录

按提示输入密码,即可进入mysql>提示符

修改密码            ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

创建数据库tmk,不指定编码,默认就是 utf8mb4, utf8mb4_0900_ai_ci

create database tmk;

指定编码创建数据库

create database tmk default character set utf8mb4 default collate utf8mb4_unicode_ci

数据库导入到新数据库

mysql.exe -u root -p --default-character-set=utf8mb4 tmk < e:\wangzhan\xxx.sql

建立一个新用户 create user 'xx3'@'localhost' identified by '123456';

刷新权限      flush privileges;

grant all on *.* to 'xx3'@'localhost';

常用命令

mysql -u root -p 123456 可以进入mysql命令提示符

show variables like '%basedir%'; 可以查看安装路径

show global variables like "%datadir%";查看数据库的存放位置

select user,host,plugin from mysql.user;查看用户

show variables like 'character_set_database';查询数据库编码

show create database tmk;查看数据库的编码格式

show create table <表名>;查看数据表的编码格式

create database <数据库名> character set utf8;创建数据库时指定数据库的字符集

alter table zoubu engine=innodb default charset=utf8mb4; 转换engine为innodb

ALTER TABLE zoubu MODIFY COLUMN bq text NOT NULL;

ALTER TABLE yqmquick MODIFY COLUMN src varchar(30) NOT NULL DEFAULT 'tb' COMMENT 'src';

创建表:默认 ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci

创建数据表时指定数据表的编码格式utf8,查询结果就是 DEFAULT CHARSET=utf8mb3

创建数据表时指定数据表的编码格式utf8mb4,查询结果就是 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

CREATE TABLE `tst` (

  `bq` varchar(250) NOT NULL,

  `ydl` int NOT NULL DEFAULT '0',

  `sycs` int DEFAULT '0' COMMENT '使用数量',

  PRIMARY KEY (`bq`)

) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;

配置php

把php.ini-development备份以后,改名为php.ini

本机安装一定要指定session.savepath.默认不指定。指定一个目录,否则重装系统的时候,session_start()找不到路径。

session.save_path = "e:/wangzhan/session"

html_errors = On

extension_dir = "ext"  扩展放开注释,前提是path先配置完成

upload_tmp_dir = "G:\wangzhanTemp" 没有改,使用默认

error_log = "E:/wangzhan/wwwqinyun/phperr.txt"

extension=bz2

extension=curl

extension=fileinfo

extension=gd

extension=mbstring

extension=exif

extension=mysqli

extension=openssl

extension=pdo_mysql

post_max_size = 20M

upload_max_filesize = 15M

//与leaderhoster配置一致

cgi.force_redirect = 0

cgi.discard_path=1

SMTP = smtp.qq.com

sendmail_path ="E:\wz\sendmail -t"

mail.log =phpmaillog.txt

////同时配置sendmail.ini   sendmail.exe准备好

smtp_server=smtp.qq.com

[email protected]

auth_password=gcbgouwzviifcgfe

配置apache

--------------------------------------------------------------------------

apache配置更改 httpd.conf

Define SRVROOT "E:/xxx/Apache24"

LoadModule access_compat_module modules/mod_access_compat.so

LoadModule deflate_module modules/mod_deflate.so

LoadModule filter_module modules/mod_filter.so

LoadModule headers_module modules/mod_headers.so

LoadModule rewrite_module modules/mod_rewrite.so

#apache配置:php7 ts

#LoadModule php7_module "E:/wz/php-7.3.10-Win32-VC15-x64/php7apache2_4.dll"

#AddHandler application/x-httpd-php .php

#PHPIniDir "E:/wz/php-7.3.10-Win32-VC15-x64"

apache配置:nts

nts版本需要apache单独安装mod_fcgi apache网站可以下载mod_fcgid 然后增加配置:

LoadModule fcgid_module modules/mod_fcgid.so

Include conf/extra/httpd-fcgid.conf

ServerName qinyun.local

    AllowOverride none

    Require all granted

DocumentRoot "E:/wz/wwwqinyun"

Options Indexes FollowSymLinks

    AllowOverride All

    Require all granted

不使用此处的日志。日志定义在虚拟主机。

#ErrorLog "logs/error.log"

#CustomLog "logs/access.log" common

Include conf/extra/httpd-vhosts.conf

#Include conf/extra/httpd-ssl.conf

httpd-fcgid.conf的配置

FcgidInitialEnv PATH "D:/xxx/php-8.0.12-nts-Win32-vs16-x64;C:/WINDOWS/system32;C:/WINDOWS;C:/WINDOWS/System32/Wbem;"

FcgidInitialEnv SystemRoot "C:/Windows"

FcgidInitialEnv SystemDrive "C:"

FcgidInitialEnv TEMP "C:\\Users\\hh\\AppData\\Local\\Temp"

FcgidInitialEnv TMP "C:\\Users\\hh\\AppData\\Local\\Temp"

FcgidInitialEnv windir "C:/WINDOWS"

FcgidIOTimeout 120

FcgidConnectTimeout 120

FcgidMaxRequestsPerProcess 500

FcgidMaxProcesses 15

FcgidOutputBufferSize 64

ProcessLifeTime 3600

FcgidMaxRequestLen 8131072

# Location php.ini:

FcgidInitialEnv PHPRC "D:/xxx/php-8.0.12-nts-Win32-vs16-x64"

FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000

  AddHandler fcgid-script .php

  FcgidWrapper "D:/xxx/php-8.0.12-nts-Win32-vs16-x64/php-cgi.exe" .php

httpd-vhosts.conf的配置

    DocumentRoot "D:/xxx/wwwqinyun"

    ServerName qinyun.local

    ErrorLog "logs/fcgi.qinyunError.log"

    CustomLog "logs/fcgi.qinyunAccess.log" common

   

        Options Indexes FollowSymLinks ExecCGI

        AllowOverride all

        Require all granted

   

    DocumentRoot "D:/xxx/wwwqinyun/wenzi"

    ServerName ttf.qinyun.local

    ErrorLog "logs/fcgi.qinyunError.log"

    CustomLog "logs/fcgi.qinyunAccess.log" common

   

        Options Indexes FollowSymLinks ExecCGI

        AllowOverride all

        Require all granted

   

httpd-ssl.conf参考配置----没有配置

DocumentRoot "E:/wz/wwwgujipu"

ServerName gujipu.local:443

ServerAdmin [email protected]

ErrorLog "${SRVROOT}/logs/gujipuError.log"

TransferLog "${SRVROOT}/logs/gujipuAccess.log"

SSLEngine on

SSLCertificateFile "${SRVROOT}/bin/serverqmgj.crt"

SSLCertificateKeyFile "${SRVROOT}/bin/serverqmgjBjm.key"

    SSLOptions +StdEnvVars

    SSLOptions +StdEnvVars

    Options Indexes FollowSymLinks

    AllowOverride All

    Require all granted

BrowserMatch "MSIE [2-5]" \

        nokeepalive ssl-unclean-shutdown \

        downgrade-1.0 force-response-1.0

CustomLog "${SRVROOT}/logs/ssl_request.log" \

          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

安装服务

httpd.exe -k install

sc start apache2.4

你可能感兴趣的:(apache php mysql安装升级)