假如MySQL root用户密码忘记,可以通过修改配置文件来登录MySQL,修改密码。
修改配置文件,在 /etc/my.cnf 中,
生存并退出,重启MySQL,
此时进入MySQL,就已经不须要密码了,直接输入MySQL就会进入。
更改密码
- update mysql
- .user set authentication_string=password('123456') where user'root' and host'localhost';
复制代码
革新权限
修改完之后要及时删除配置项
更改完文件之后,要重启MySQL。
此时用新密码登录MySQL root用户。
yum 安装nginx
启动nginx
用命令查看80端口
发现nginx
已经启动。
摆设php
进入rpm软件包仓库网站。
https://rpms.remirepo.net/ 是一个 RPM 软件包仓库,它提供大量的 PHP 和相干扩展包
Remi's RPM repository (remirepo.net)https://rpms.remirepo.net/
右键-复制链接。
在终端中用yum举行下载。
- yum -y install php74-php-fpm
复制代码- yum -y install php74-php-xsl php74-php php74-php-cli php74-php-devel php74-php-gd php74-php-pdo php74-php-mysql
- php74-php-fpm
复制代码
启动php
- systemctl restart php74-php-fpm
复制代码
查抄是否启动乐成
nginx
关联php
将nginx
文件备份,文件在 /etc/nginx
/nginx
.conf。
- cp /etc/nginx
- /nginx
- .conf /etc/nginx
- /nginx
- .conf.bak
复制代码
对nginx
配置文件举行编辑
- vim /etc/nginx
- /nginx
- .conf
复制代码 可以用 加个+42来指定文件开启时光标在第42行。
- vim +42 /etc/nginx
- /nginx
- .conf
复制代码
在第42行下举行编辑,添加以下代码
- index index.php index.html index.htm; location ~ \.php$ { include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/share/nginx
- /html/$fastcgi_script_name; }
复制代码
可以用nginx
-t 来检测是否有语法问题
配置文件语法没有问题后,重启nginx
编写一个探测文件来查看nginx
和php是否毗连乐成
用欣赏器访问ip地址,显示下面界面,就体现毗连乐成。
接下来就是让项目上线
将压缩包从本地上传到虚拟机中。解压
- tar -zxvf wordpress-6.2.2-zh_CN.tar.gz
复制代码
将解压后的目录下的文件和目录拷贝到 /usr/share/nginx
/html/ 目录下
- cp -r /root/wordpress/* /usr/share/nginx
- /html/
复制代码 删除之前的测试文件index.php。
进入mysql
中创建数据库
- create database wordpress;
复制代码
打开欣赏器访问ip地址。
这里输入刚刚创建的数据库名wordpress,用户名root 。
点击提交后,看到无法写入wp-config.php文件,须要我们手动创建并配置。
须要创建在 /usr/share/nginx
/html 目录下,
将以下代码添加到文件中。
- <?php
- /**
- * The base configuration for WordPress
- *
- * The wp-config.php creation script uses this file during the installation.
- * You don't have to use the web site, you can copy this file to "wp-config.php"
- * and fill in the values.
- *
- * This file contains the following configurations:
- *
- * * Database settings
- * * Secret keys
- * * Database table prefix
- * * ABSPATH
- *
- * @link https://wordpress.org/documentation/article/editing-wp-config-php/
- *
- * @package WordPress
- */
- // ** Database settings - You can get this info from your web host ** //
- /** The name of the database for WordPress */
- define( 'DB_NAME', 'wordpress' );
- /** Database username */
- define( 'DB_USER', 'root' );
- /** Database password */
- define( 'DB_PASSWORD', '123' );
- /** Database hostname */
- define( 'DB_HOST', 'localhost' );
- /** Database charset to use in creating database tables. */
- define( 'DB_CHARSET', 'utf8mb4' );
- /** The database collate type. Don't change this if in doubt. */
- define( 'DB_COLLATE', '' );
- /**#@+
- * Authentication unique keys and salts.
- *
- * Change these to different unique phrases! You can generate these using
- * the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
- *
- * You can change these at any point in time to invalidate all existing cookies.
- * This will force all users to have to log in again.
- *
- * @since 2.6.0
- */
- define( 'AUTH_KEY', '^ES>dqfaA%hn5{P[VB!I d3 gezm;J`agkJ~m<E58/*a<(q:D, O)7rIjQGkd|1@' );
- define( 'SECURE_AUTH_KEY', 'kqD}9<+<?Mc3d+4N+v71Zq+OS=|m-@l(J|lSMKi_x5+Wi-!b|uvDs%qT!`MDJ[*=' );
- define( 'LOGGED_IN_KEY', 'I.$A3BAHf<grZ.;q3]c+D{3%cS#&L!SDo%NIi_PXjvq3Bivt*Ue+h&TX-{Wj9%}?' );
- define( 'NONCE_KEY', 'rJW2hf(L|8T(!.ek^GFLCDr0.#K3_mYnP3HO@:s6Q(%:tAUwYCE_[~M%f$)?[Ck%' );
- define( 'AUTH_SALT', 'wH/OAd`MEb9[gzu3PT_tVv3m/I%p*@eo*CVe`^KyH5_:{`WdN2%Z-xns0.E_+W#g' );
- define( 'SECURE_AUTH_SALT', 'q~ej>{5{%3(59J&hOP;Z{Gn-NLbsIaLvZRniA=jkhCNj/&|3ssR*(r%R,xq==1NW' );
- define( 'LOGGED_IN_SALT', '<t*,_SprcP>6EG=wSXIFm]93SK$A8Vc-B0E>*d2lg[<CE#X}{m:nvtE4%5c#kip]' );
- define( 'NONCE_SALT', 'QP9To>rx:oA,X5D%2cV^Ni,Zr7S_BwUdAvEj)@scV-To9Hv%?U$O=v*]1Z[+|Sr!' );
- /**#@-*/
- /**
- * WordPress database table prefix.
- *
- * You can have multiple installations in one database if you give each
- * a unique prefix. Only numbers, letters, and underscores please!
- */
- $table_prefix = 'wp_';
- /**
- * For developers: WordPress debugging mode.
- *
- * Change this to true to enable the display of notices during development.
- * It is strongly recommended that plugin and theme developers use WP_DEBUG
- * in their development environments.
- *
- * For information on other constants that can be used for debugging,
- * visit the documentation.
- *
- * @link https://wordpress.org/documentation/article/debugging-in-wordpress/
- */
- define( 'WP_DEBUG', false );
- /* Add any custom values between this line and the "stop editing" line. */
- /* That's all, stop editing! Happy publishing. */
- /** Absolute path to the WordPress directory. */
- if ( ! defined( 'ABSPATH' ) ) {
- define( 'ABSPATH', __DIR__ . '/' );
- }
- /** Sets up WordPress vars and included files. */
- require_once ABSPATH . 'wp-settings.php';
复制代码
然后点击运行安装程序。会进入这个界面。填入信息。
点击安装WordPress。安装乐成。点击登录。
输入用户名和密码,登录。
显示这个界面,乐成了。
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |