Loading... 最近遇到一些问题需要初始化centos8。于是开始准备备份各项内容。 #备份nginx和php设置 需要备份的目录 /etc/nginx /etc/php-fpm.d /usr/share/nginx 备份数据库 ```shell mysqldump –u root –p typecho>typecho.sql ``` 如果有ssl记得保存证书文件。 #新系统安装 安装各种包 ```shell yum -y install httpd php php-fpm nginx mariadb mariadb-server php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-devel php-mysqli ``` 设置开机启动+开启服务 ```shell systemctl enable nginx systemctl enable mariadb systemctl enable php-fpm systemctl start nginx systemctl start mariadb systemctl start php-fpm ``` 拷贝刚保存的文件到新系统。 添加nginx用户 ```shell useradd nginx passwd nginx ``` 授权用户权限 ```shell chown nginx:nginx -R /usr/share/nginx ``` ##数据库初始化 登录数据库,初始密码为空直接回车 ```shell mysql -u root -p ``` 新建空typecho数据库供后面恢复使用 ```sql create database typecho; ``` 切换数据库 ```sql use mysql; ``` 设置新密码 ```sql update user set password=password("你的密码")where user='root'; ``` 刷新并退出 ```sql flush privileges; exit; ``` 将备份的数据库放入/root文件夹后直接导入 ```shell mysql –u root –p typecho<typecho.sql ``` 接下来重启一下各种服务 ```shell systemctl restart nginx systemctl restart php-fpm ``` 最后修改:2021 年 01 月 22 日 © 允许规范转载 打赏 赞赏作者 如果觉得我的文章对你有用,请随意赞赏