一、忘记数据库root密码
1.vim /etc/my.cnf
2.skip-grant-tables(需要打开密码强度策略,具体步骤看上一篇文章)
3.重启数据库
systemctl restart mysqld
4.desc mysql.user; | select * from user\
5.update user set authentication_string=password("新密码") where User='root' and host ='localhost';
6.刷新授权
flush privileges;
7.第一时间关闭跳过授权:
skip-grant-tables
8.关闭策略强度
拓展:
SQL语句修改密码: set password for 用户名@localhost ='新密码'
LNMP
L:linux N: nginx M:mysql P:php
二、wordpress项目部署
1.部署nginx
yum -y install nginx
2.启动nginx
nginx
3.检查是否启动成功
ss -nplt | grep 80 或者 ps aux | grep nginx
4.部署php
1):yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
2).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
5.启动php
systemctl start php74-php-fpm
6.检查是否启动成功
ss -nplt | grep 9000
ps aux | grep php
7.nginx关联php
cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.old
vim +42 /etc/nginx/nginx.conf
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;
}
8.检查nginx配置文件的语法
nginx -t
9.重新加载配置文件
nginx -s reload
10. 探测文件
vim /usr/share/nginx/html/index.php
<?pho
phpinfo();
?>
三、项目上线
1.上传项目
rz 弹出的文件选择框中选择项目包
2.tar -xf wordpress-6.2.2-zh_CN.tar.gz
3.cp -r wordpress/* /usr/share/nginx/html/