windows build web Environment (WAMP environment)

What a .WAMP that?

apache is a server-side software, mysql is a database software, php is a web programming language (server-side scripting language).

Page programs written in PHP running on apache, data bearer and read by myspl, the last page will appear on the user's browser.

Already installed apache2.4 and php7.2.26, Next, install mysql, mysql version you want, apache version is compatible with php, here select mysql5.7

II. Installation mysql5.7.29

Reference: https: //jingyan.baidu.com/article/0f5fb0991636376d8234ea7a.html

Download: https://dev.mysql.com/downloads/mysql/

Download over a compressed package, it requires manual configuration. You can also download the installer (* .msi / exe).

This is my web environment directory

1, the configuration file my.ini.

New \ web \ under mysql-5.7.29-winx64 (Note that this directory to be your own directory, I am here to download the 5.7 version, if you download the 5.5 version, this directory is not the same) directory: C a configuration file, a file called my.ini, and then copy the following configuration code to the (path in the code to change their file storage path) in my.ini. Figure:

[mysql]
# mysql client set the default character set
default-character-set = utf8

[mysqld]
# 3306 port disposed
port = 3306

Set # mysql installation directory
basedir = C: \ web \ mysql -5.7.29-winx64

# Mysql database setting data storage directory
datadir = C: \ web \ mysql -5.7.29-winx64 \ data

# Allowed maximum number of connections
max_connections = 200

# Server default character set used for the 8-bit coded character set latin1
character-set-server = utf8

# Will be used when you create a new default storage engine table
default-storage-engine = INNODB

 

 

 2, install mysql service:

Run as administrator C: \ Windows to find \ System32 directory under the cmd.exe, attention must be run as an administrator, or can not be installed successfully.

Open an administrator cmd window, change the directory to the bin directory where you extracted the file, and then enter the mysqld install Enter to run on the line, pay attention Yes mysqld, not mysql. Directly into my picture in cmd command on the line. Figure:

 

 

 Encounter problems, because there is no installation vc ++ 2013

Download: https://www.microsoft.com/zh-CN/download/details.aspx?id=40784

After downloading and installing re-enter service successfully installed mysql

 

 

 After a successful installation, it was directly after mysql -uroot -p input and then return, still no prompts to connect to the database, which is why? This is because after the successful installation of mysql, mysql services but also open to use.

3, start mysql service.

problem appear

 

 

 

 

 

 Can only delete the original service, re-find a way

initialization! mysqld --initialize-insecure --user = mysql, the document shows that the use -initialize generate random passwords, because of their learning, using -initialize-insecure generate a blank password. The default account root, back -user = mysql not change

Then run:

 

 

If you give the service name, you can enter the following command:

输入mysql -uroot -p  空密码

 

 三.为Apache,php,mysql配置环境变量

 

C:\web\Apache24\bin;C:\web\mysql-5.7.29-winx64\bin;C:\web\php-7.2.26-Win32-VC15-x64

检验一下

httpd命令:https://www.runoob.com/linux/linux-comm-httpd.html

 

 php命令行:https://www.php.cn/php-weizijiaocheng-377159.html

 

 四.php操作mysql

 

 

 因为没有开启mysql扩展,但是php7废除了mysql,这里测试改为mysqli

 指定扩展文件所在的目录

 

 

开启mysqli扩展

 

 

 php语句改为

 

 至此,数据库连接成功,WAMP配置完成。

Guess you like

Origin www.cnblogs.com/lpxspring/p/12202157.html