阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

CentOS7下安装部署LAMP环境

135次阅读
没有评论

共计 15907 个字符,预计需要花费 40 分钟才能阅读完成。

(1)配置概要:
  1、172.18.17.7 主机运行 httpd+php 服务(php 为模块工作模式)
  配置两台虚拟主机:wordpress 个人博客系统、PHPmyadmin 远程控制 MySQL

  2、172.18.17.8 主机运行 mariadb 服务(mysql)

(2)配置流程:
  首先配置 172.18.17.7 主机:http 服务           
  1、安装程序:
[root@johnson’s linux ~]# yum install httpd php php-mysql php-mbstring
 
========================================================================================
 Package              Arch            Version                      Repository    Size
========================================================================================
Installing:
 httpd                x86_64          2.4.6-40.el7.CentOS          base          2.7 M
 php                  x86_64          5.4.16-36.el7_1              base          1.4 M
 php-mbstring          x86_64          5.4.16-36.el7_1              base          503 k
 php-mysql            x86_64          5.4.16-36.el7_1              base          99 k
 
Transaction Summary
=======================================================================================

httpd:提供 web 服务
php:安装后自动编译为 httpd 的模块,用于处理动态资源 php 脚本
php-mbstring:此程序包为 phpMyAdmin 远程控制 mysql 所必须的
php-mysql:php 驱动 mysql 的库文件程序包

2、服务配置

包都安装完成之后,进入下一步的配置阶段:

(1)添加虚拟主机:(基于 FQDN)
  虚拟主机有三种配置方式:一种是基于不同 ip,相同端口(80),二是相同 IP 不同端口,三是同一 IP 不同主机名(FQDN),不管何种配置方式,最后解析到的主机只有一台,但是在请求报文首部信息会有不同!以下,仅演示基于 FQDN 的配置方式

    编辑:/etc/httpd/conf.d/vhost.conf 文件
[root@johnson’s linux ~]# vim /etc/httpd/conf.d/vhost.conf 
# 添加如下内容,基于 FQDN 的虚拟主机配置
<VirtualHost 172.18.17.7:80>  # 固定语法 <VirtualHost ip:port> 可忽略大小写
    ServerName  # 很重要,基于 FQDN 的虚拟主机必须要有主机名 
    DocumentRoot “/www/host/htdoc” # 虚拟主机根目录,可指定路径 
<Directory “/www/host/htdoc”>  # 对虚拟主机根目录的权限设置
    Options FollowSymLinks    # FollowSymLinks  表示可以访问符号连接资源
    require all Granted    # 目录的权限设置
</Directory>               
</VirtualHost>
 
<VirtualHost 172.18.17.7:80>
    ServerName www.myadmin.com
    DocumentRoot “/www/host2/htdoc”
<Directory “/www/host2/htdoc”>
    Options FollowSymLinks
    require all Granted
</Directory>
</VirtualHost>

Options:为个目录的选项,可以指定多个特性
    如:Index,启动资源索引,其作用是在用户在访问指定的 URL 不存在时,返回 web 资源索引,此选项
非常危险,不建议启用,否则源码则会 web 源码暴露,后果很严重

访问权限设定:
Require all Granted/deny,Granted 表示允许,all 表示所有,deny 表示拒绝
    需要注意的是:CentOS7 是默认拒绝所有主机访问 DocumentRoot 的资源,所以,配置虚拟主机必须要配置此先参数

(2)为虚拟主机创建配置文件中定义的资源目录并
[root@johnson’s linux ~]# mkdir/www/{host,host2}/htdoc

(3)添加测试资源
[root@johnson’s linux ~]# vim /www/host/htdoc/index.php
# 前面这段是测试 php 与 mysql 连通性的 PHP 代码
<?php
    $conn = mysql_connect(‘172.18.17.8′,’admin’,’admin’); # ip 填写 mysql 主机 ip
    if ($conn)                                          # 用户为 mysql 所授权的用户,密码空
        echo “DATABASE Connet OK”;
    else
        echo “DATABASE Connet Failure”;
?>
# 测试 php 是否正常工作的 php 代码
<?php
    phpinfo() #此函数调用会显示 php 的详细信息
?>

(4)配置 httpd 主配置文件
编辑:/etc/httpd/conf/httpd.conf
[root@johnson’s linux ~]# vim /etc/httpd/conf/httpd.conf
# 找到 DocumentRoot “/var/www/html”,# 将其注释掉,一般使用虚拟机都要注释掉,避免冲突
#DocumentRoot “/var/www/html”
 
# 添加 php 主页索引
DirectoryIndex index.php index.html # 将 index.php 添加在前头,这样就会默认访问此类资源索引
 
# 取消服务器名称注释

(5)启动服务,测试是否正常
# 检测配置文件语法有没有错误
[root@johnson’s linux ~]# httpd -t
# 语法无误启动服务
[root@johnson’s linux ~]# systemctl start httpd.service

打开网页查看服务是否正常   

CentOS7 下安装部署 LAMP 环境   

http 服务测试正常,php 模块也能正常工作,但是,如你所见,mysql 的连接是失败,因为我们还 mysql 的服务器还没有配置

下面关于 LAMP 相关 的内容你可能也喜欢

LAMP 平台安装 Xcache 和 Memcached 加速网站运行  http://www.linuxidc.com/Linux/2015-06/118835.htm 

CentOS 7 下搭建 LAMP 平台环境  http://www.linuxidc.com/Linux/2015-06/118818.htm

CentOS 6.5 系统安装配置 LAMP(Apache+PHP5+MySQL)服务器环境 http://www.linuxidc.com/Linux/2014-12/111030.htm

Ubuntu 14.04 配置 LAMP+phpMyAdmin PHP(5.5.9)开发环境  http://www.linuxidc.com/Linux/2014-10/107924.htm

Ubuntu 14.10 下安装 LAMP 服务图文详解  http://www.linuxidc.com/Linux/2014-12/110082.htm

LAMP 结合 NFS 构建小型博客站点  http://www.linuxidc.com/Linux/2015-08/121029.htm

(5)获取 wordpress 和 phpmyadmin
博主的是在局域网中 ftp 服务器中下载的
wordpress 配置:

# 下载并解压至 /www/host/htdoc
# cd 到 wordpress 目录,配置文件如下
[root@johnson’s linux wordpress]# ls
index.php        wp-blog-header.php    wp-cron.php        wp-mail.php
license.txt      wp-comments-post.php  wp-includes        wp-settings.php
readme.html      wp-links-opml.php    wp-signup.php
wp-activate.php  wp-config-sample.php  wp-load.php        wp-trackback.php
wp-admin        wp-content            wp-login.php      xmlrpc.php
 
# 复制配置文件以上的 wp-config-sample.php 为 wp-config.php
[root@johnson’s linux wordpress]# cp wp-config-sample.php  wp-config.php
 
# 编辑配置文件
[root@johnson’s linux wordpress]# vim wp-config.php
// ** MySQL 设置 – 具体信息来自您正在使用的主机 ** //
/** WordPress 数据库的名称 */
define(‘DB_NAME’, ‘wpdb’);  # 此填写 mysql 所要授权数据库的名字(后面会配置)
 
/** MySQL 数据库用户名 */
 
define(‘DB_USER’, ‘wpuser’); # 填写数据库的用户名
 
/** MySQL 数据库密码 */
define(‘DB_PASSWORD’, ‘wppasswd’); # 填写数据的密码
 
/** MySQL 主机 */
define(‘DB_HOST’, ‘172.18.17.8’); # 填写 mysql 主机的 ip
 
/** 创建数据表时默认的文字编码 */
define(‘DB_CHARSET’, ‘utf8’);
 
/** 数据库整理类型。如不确定请勿更改 */
define(‘DB_COLLATE’, ”);

 

phpmyadmin 配置:
1234567891011121314151617181920212223242526272829303132 # 将包下载并解压至 /www/host2/htdoc
# cd 到 文件目录
# 创建符号连接
[root@johnson’s linux htdoc]# ln -s phpMyAdmin-4.4.14.1-all-languages myadmin
[root@johnson’s linux htdoc]# ls
index.php  phpMyAdmin-4.4.14.1-all-languages 
myadmin    phpMyAdmin-4.4.14.1-all-languages.zip 
 
#cd 至 myadmin 目录里面,修改配置文件
[root@johnson’s linux htdoc]# cp config.sample.inc.php config.inc.php
 
# 编辑配置文件
[root@johnson’s linux htdoc]# vim config.inc.php
$cfg[‘blowfish_secret’] = ‘o71mI9rimj6syc00fT3g’; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
                #单引号填写随机密码,可使用 openssl rand -base64 15(密码长度)生成
                         
/*
 * Servers configuration
 */
$i = 0;
 
/*
 * First server
 */
$i++;
/* Authentication type */
$cfg[‘Servers’][$i][‘auth_type’] = ‘cookie’;
/* Server parameters */
$cfg[‘Servers’][$i][‘host’] = ‘172.18.17.8’;  # 数据库主机 ip 
$cfg[‘Servers’][$i][‘connect_type’] = ‘tcp’;
$cfg[‘Servers’][$i][‘compress’] = false;
$cfg[‘Servers’][$i][‘AllowNoPassword’] = false;

 

 

——————————————————————————–
172.18.17.8 主机配置:mysql 服务

(1)yum 安装程序
1234567891011121314151617 [root@johnson’s linux ~]# yum install mariadb-server
 
========================================================================================
Installing:
 mariadb-server              x86_64      1:5.5.44-2.el7.centos        base      11 M
Installing for dependencies:
 mariadb                      x86_64      1:5.5.44-2.el7.centos        base      8.9 M
 perl-Compress-Raw-Bzip2      x86_64      2.061-3.el7                  base      32 k
 perl-Compress-Raw-Zlib      x86_64      1:2.061-4.el7                base      57 k
 perl-DBD-MySQL              x86_64      4.023-5.el7                  base      140 k
 perl-DBI                    x86_64      1.627-4.el7                  base      802 k
 perl-IO-Compress            noarch      2.061-2.el7                  base      260 k
 perl-Net-Daemon              noarch      0.48-5.el7                    base      51 k
 perl-PlRPC                  noarch      0.2020-14.el7                base      36 k
 
Transaction Summary
========================================================================================

一大推依赖包,只要有 yum 在且 yum 源配置没有问题,可以轻松解决

 

(2)启动服务,执行安全安装操作
12345678910111213141516171819202122232425262728293031323334353637383940414243444546 [root@johnson’s linux ~]# systemctl start mariadb
# 查看监听端口,3306 为 mariaDB 的默认监听端口
[root@johnson’s linux ~]# ss -tnl
State      Recv-Q Send-Q Local Address:Port              Peer Address:Port             
LISTEN    0      50              *:3306                        *:*                 
LISTEN    0      128              *:22                          *:*                 
LISTEN    0      128            :::22                          :::*   
 
执行安全安装操作 
[root@johnson’s linux ~]# mysql_secure_installation 
 
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
 
Set root password? [Y/n] y  # 设置管理员登陆秘密(此密码和 linux 系统的 root 没关系)
 
New password: 
Re-enter new password:    # 输入密码即可
Password updated successfully!
Reloading privilege tables..
 … Success!
 
Remove anonymous users? [Y/n] y  # 是否移除匿名用户(在执行安全安装之前不需要密码登陆)
 … Success!                    # 允许匿名登陆时很危险的,建议移除
 
Disallow root login remotely? [Y/n] n  # 是否不允许管理员账号远程登陆,一般情况下建议不允许
 … skipping.                       
 
Remove test database and access to it? [Y/n] y # 移除测试数据库
 – Dropping test database… 
 … Success!
 – Removing privileges on test database…
 … Success!
 
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
 
Reload privilege tables now? [Y/n] y    # 重载权限表
 … Success!
 
Cleaning up…
 
All done!  If you’ve completed all of the above steps, your MariaDB
installation should now be secure.
 
Thanks for using MariaDB!

强烈建议在 mariaDB 安装完成后执行安全安装操作,这样可以使得数据库更安全

(3)创建所需数据库并授权

[root@johnson’s linux ~]# MySQL -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 66
Server version: 5.5.44-MariaDB MariaDB Server
 
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
 
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
 
MariaDB [(none)]> CREATE DATABASE wpdb; # 创建 wordpress 的数据库
Query OK, 1 row affected (0.02 sec)   
 
# 授权 wordpress 数据库
MariaDB [(none)]> GRANT ALL ON wpdb.* TO wpuser@172.18.17.7 IDENTIFIED BY ‘wppasswd’;
Query OK, 0 rows affected (0.01 sec)
 
# 授权远程访问主机(phpMyadmin)
MariaDB [(none)]> GRANT ALL ON *.* TO admin@’172.18.17.7′ IDENTIFIED BY ‘admin’; 
Query OK, 0 rows affected (0.01 sec)

(4)支持所有配置基本完毕:验证结果
 1、验证数据库联通
CentOS7 下安装部署 LAMP 环境

2、查看 wordpress 是否正常

CentOS7 下安装部署 LAMP 环境

CentOS7 下安装部署 LAMP 环境

CentOS7 下安装部署 LAMP 环境

不知为何,我的 phpmyadmin 显示不大正常,能跑起来就行!配置到此结束!
最后补充一下:
phpMyadmin 常见错误:
    1. 缺少 mbstring 插件
    yum 安装 php-mbstring 即可

    2. 丢失 session 目录
  一般 在 /var/lib/php/session,没有则创建即可

本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-04/130653.htm

(1)配置概要:
  1、172.18.17.7 主机运行 httpd+php 服务(php 为模块工作模式)
  配置两台虚拟主机:wordpress 个人博客系统、PHPmyadmin 远程控制 MySQL

  2、172.18.17.8 主机运行 mariadb 服务(mysql)

(2)配置流程:
  首先配置 172.18.17.7 主机:http 服务           
  1、安装程序:
[root@johnson’s linux ~]# yum install httpd php php-mysql php-mbstring
 
========================================================================================
 Package              Arch            Version                      Repository    Size
========================================================================================
Installing:
 httpd                x86_64          2.4.6-40.el7.CentOS          base          2.7 M
 php                  x86_64          5.4.16-36.el7_1              base          1.4 M
 php-mbstring          x86_64          5.4.16-36.el7_1              base          503 k
 php-mysql            x86_64          5.4.16-36.el7_1              base          99 k
 
Transaction Summary
=======================================================================================

httpd:提供 web 服务
php:安装后自动编译为 httpd 的模块,用于处理动态资源 php 脚本
php-mbstring:此程序包为 phpMyAdmin 远程控制 mysql 所必须的
php-mysql:php 驱动 mysql 的库文件程序包

2、服务配置

包都安装完成之后,进入下一步的配置阶段:

(1)添加虚拟主机:(基于 FQDN)
  虚拟主机有三种配置方式:一种是基于不同 ip,相同端口(80),二是相同 IP 不同端口,三是同一 IP 不同主机名(FQDN),不管何种配置方式,最后解析到的主机只有一台,但是在请求报文首部信息会有不同!以下,仅演示基于 FQDN 的配置方式

    编辑:/etc/httpd/conf.d/vhost.conf 文件
[root@johnson’s linux ~]# vim /etc/httpd/conf.d/vhost.conf 
# 添加如下内容,基于 FQDN 的虚拟主机配置
<VirtualHost 172.18.17.7:80>  # 固定语法 <VirtualHost ip:port> 可忽略大小写
    ServerName  # 很重要,基于 FQDN 的虚拟主机必须要有主机名 
    DocumentRoot “/www/host/htdoc” # 虚拟主机根目录,可指定路径 
<Directory “/www/host/htdoc”>  # 对虚拟主机根目录的权限设置
    Options FollowSymLinks    # FollowSymLinks  表示可以访问符号连接资源
    require all Granted    # 目录的权限设置
</Directory>               
</VirtualHost>
 
<VirtualHost 172.18.17.7:80>
    ServerName www.myadmin.com
    DocumentRoot “/www/host2/htdoc”
<Directory “/www/host2/htdoc”>
    Options FollowSymLinks
    require all Granted
</Directory>
</VirtualHost>

Options:为个目录的选项,可以指定多个特性
    如:Index,启动资源索引,其作用是在用户在访问指定的 URL 不存在时,返回 web 资源索引,此选项
非常危险,不建议启用,否则源码则会 web 源码暴露,后果很严重

访问权限设定:
Require all Granted/deny,Granted 表示允许,all 表示所有,deny 表示拒绝
    需要注意的是:CentOS7 是默认拒绝所有主机访问 DocumentRoot 的资源,所以,配置虚拟主机必须要配置此先参数

(2)为虚拟主机创建配置文件中定义的资源目录并
[root@johnson’s linux ~]# mkdir/www/{host,host2}/htdoc

(3)添加测试资源
[root@johnson’s linux ~]# vim /www/host/htdoc/index.php
# 前面这段是测试 php 与 mysql 连通性的 PHP 代码
<?php
    $conn = mysql_connect(‘172.18.17.8′,’admin’,’admin’); # ip 填写 mysql 主机 ip
    if ($conn)                                          # 用户为 mysql 所授权的用户,密码空
        echo “DATABASE Connet OK”;
    else
        echo “DATABASE Connet Failure”;
?>
# 测试 php 是否正常工作的 php 代码
<?php
    phpinfo() #此函数调用会显示 php 的详细信息
?>

(4)配置 httpd 主配置文件
编辑:/etc/httpd/conf/httpd.conf
[root@johnson’s linux ~]# vim /etc/httpd/conf/httpd.conf
# 找到 DocumentRoot “/var/www/html”,# 将其注释掉,一般使用虚拟机都要注释掉,避免冲突
#DocumentRoot “/var/www/html”
 
# 添加 php 主页索引
DirectoryIndex index.php index.html # 将 index.php 添加在前头,这样就会默认访问此类资源索引
 
# 取消服务器名称注释

(5)启动服务,测试是否正常
# 检测配置文件语法有没有错误
[root@johnson’s linux ~]# httpd -t
# 语法无误启动服务
[root@johnson’s linux ~]# systemctl start httpd.service

打开网页查看服务是否正常   

CentOS7 下安装部署 LAMP 环境   

http 服务测试正常,php 模块也能正常工作,但是,如你所见,mysql 的连接是失败,因为我们还 mysql 的服务器还没有配置

下面关于 LAMP 相关 的内容你可能也喜欢

LAMP 平台安装 Xcache 和 Memcached 加速网站运行  http://www.linuxidc.com/Linux/2015-06/118835.htm 

CentOS 7 下搭建 LAMP 平台环境  http://www.linuxidc.com/Linux/2015-06/118818.htm

CentOS 6.5 系统安装配置 LAMP(Apache+PHP5+MySQL)服务器环境 http://www.linuxidc.com/Linux/2014-12/111030.htm

Ubuntu 14.04 配置 LAMP+phpMyAdmin PHP(5.5.9)开发环境  http://www.linuxidc.com/Linux/2014-10/107924.htm

Ubuntu 14.10 下安装 LAMP 服务图文详解  http://www.linuxidc.com/Linux/2014-12/110082.htm

LAMP 结合 NFS 构建小型博客站点  http://www.linuxidc.com/Linux/2015-08/121029.htm

(5)获取 wordpress 和 phpmyadmin
博主的是在局域网中 ftp 服务器中下载的
wordpress 配置:

# 下载并解压至 /www/host/htdoc
# cd 到 wordpress 目录,配置文件如下
[root@johnson’s linux wordpress]# ls
index.php        wp-blog-header.php    wp-cron.php        wp-mail.php
license.txt      wp-comments-post.php  wp-includes        wp-settings.php
readme.html      wp-links-opml.php    wp-signup.php
wp-activate.php  wp-config-sample.php  wp-load.php        wp-trackback.php
wp-admin        wp-content            wp-login.php      xmlrpc.php
 
# 复制配置文件以上的 wp-config-sample.php 为 wp-config.php
[root@johnson’s linux wordpress]# cp wp-config-sample.php  wp-config.php
 
# 编辑配置文件
[root@johnson’s linux wordpress]# vim wp-config.php
// ** MySQL 设置 – 具体信息来自您正在使用的主机 ** //
/** WordPress 数据库的名称 */
define(‘DB_NAME’, ‘wpdb’);  # 此填写 mysql 所要授权数据库的名字(后面会配置)
 
/** MySQL 数据库用户名 */
 
define(‘DB_USER’, ‘wpuser’); # 填写数据库的用户名
 
/** MySQL 数据库密码 */
define(‘DB_PASSWORD’, ‘wppasswd’); # 填写数据的密码
 
/** MySQL 主机 */
define(‘DB_HOST’, ‘172.18.17.8’); # 填写 mysql 主机的 ip
 
/** 创建数据表时默认的文字编码 */
define(‘DB_CHARSET’, ‘utf8’);
 
/** 数据库整理类型。如不确定请勿更改 */
define(‘DB_COLLATE’, ”);

 

phpmyadmin 配置:
1234567891011121314151617181920212223242526272829303132 # 将包下载并解压至 /www/host2/htdoc
# cd 到 文件目录
# 创建符号连接
[root@johnson’s linux htdoc]# ln -s phpMyAdmin-4.4.14.1-all-languages myadmin
[root@johnson’s linux htdoc]# ls
index.php  phpMyAdmin-4.4.14.1-all-languages 
myadmin    phpMyAdmin-4.4.14.1-all-languages.zip 
 
#cd 至 myadmin 目录里面,修改配置文件
[root@johnson’s linux htdoc]# cp config.sample.inc.php config.inc.php
 
# 编辑配置文件
[root@johnson’s linux htdoc]# vim config.inc.php
$cfg[‘blowfish_secret’] = ‘o71mI9rimj6syc00fT3g’; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
                #单引号填写随机密码,可使用 openssl rand -base64 15(密码长度)生成
                         
/*
 * Servers configuration
 */
$i = 0;
 
/*
 * First server
 */
$i++;
/* Authentication type */
$cfg[‘Servers’][$i][‘auth_type’] = ‘cookie’;
/* Server parameters */
$cfg[‘Servers’][$i][‘host’] = ‘172.18.17.8’;  # 数据库主机 ip 
$cfg[‘Servers’][$i][‘connect_type’] = ‘tcp’;
$cfg[‘Servers’][$i][‘compress’] = false;
$cfg[‘Servers’][$i][‘AllowNoPassword’] = false;

 

 

——————————————————————————–
172.18.17.8 主机配置:mysql 服务

(1)yum 安装程序
1234567891011121314151617 [root@johnson’s linux ~]# yum install mariadb-server
 
========================================================================================
Installing:
 mariadb-server              x86_64      1:5.5.44-2.el7.centos        base      11 M
Installing for dependencies:
 mariadb                      x86_64      1:5.5.44-2.el7.centos        base      8.9 M
 perl-Compress-Raw-Bzip2      x86_64      2.061-3.el7                  base      32 k
 perl-Compress-Raw-Zlib      x86_64      1:2.061-4.el7                base      57 k
 perl-DBD-MySQL              x86_64      4.023-5.el7                  base      140 k
 perl-DBI                    x86_64      1.627-4.el7                  base      802 k
 perl-IO-Compress            noarch      2.061-2.el7                  base      260 k
 perl-Net-Daemon              noarch      0.48-5.el7                    base      51 k
 perl-PlRPC                  noarch      0.2020-14.el7                base      36 k
 
Transaction Summary
========================================================================================

一大推依赖包,只要有 yum 在且 yum 源配置没有问题,可以轻松解决

 

(2)启动服务,执行安全安装操作
12345678910111213141516171819202122232425262728293031323334353637383940414243444546 [root@johnson’s linux ~]# systemctl start mariadb
# 查看监听端口,3306 为 mariaDB 的默认监听端口
[root@johnson’s linux ~]# ss -tnl
State      Recv-Q Send-Q Local Address:Port              Peer Address:Port             
LISTEN    0      50              *:3306                        *:*                 
LISTEN    0      128              *:22                          *:*                 
LISTEN    0      128            :::22                          :::*   
 
执行安全安装操作 
[root@johnson’s linux ~]# mysql_secure_installation 
 
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
 
Set root password? [Y/n] y  # 设置管理员登陆秘密(此密码和 linux 系统的 root 没关系)
 
New password: 
Re-enter new password:    # 输入密码即可
Password updated successfully!
Reloading privilege tables..
 … Success!
 
Remove anonymous users? [Y/n] y  # 是否移除匿名用户(在执行安全安装之前不需要密码登陆)
 … Success!                    # 允许匿名登陆时很危险的,建议移除
 
Disallow root login remotely? [Y/n] n  # 是否不允许管理员账号远程登陆,一般情况下建议不允许
 … skipping.                       
 
Remove test database and access to it? [Y/n] y # 移除测试数据库
 – Dropping test database… 
 … Success!
 – Removing privileges on test database…
 … Success!
 
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
 
Reload privilege tables now? [Y/n] y    # 重载权限表
 … Success!
 
Cleaning up…
 
All done!  If you’ve completed all of the above steps, your MariaDB
installation should now be secure.
 
Thanks for using MariaDB!

强烈建议在 mariaDB 安装完成后执行安全安装操作,这样可以使得数据库更安全

正文完
星哥说事-微信公众号
post-qrcode
 
星锅
版权声明:本站原创文章,由 星锅 2022-01-21发表,共计15907字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中