CentOS7安装Apache+PHP+MariaDB
程序员文章站
2022-05-11 19:05:48
...
首先,安装Apache服务器
yum install httpd
第二,安装PHP及常用软件包
yum install php httpd-manual mod_ssl mod_perl mod_auth_mysql
yum install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc
yum install mysql-connector-odbc mysql-devel libdbi-dbd-mysql
第三,安装MariaDB
yum install mariadb*
第四,启动服务
systemctl start httpd.service
systemctl start mariadb.service
第五,如果第四部成功,则设置两个服务自动启动
systemctl enable httpd.service
systemctl enable mariadb.service
第六,设置数据库服务器
[root@rachel ~]# mysql -u root #无密码登录数据库
Welcome tothe MariaDB monitor. Commands endwith ; or \g.
Your MariaDB connection idis3
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)]> select user, host, password from mysql.user; #检索数据库用户
+------+--------------+----------+
| user | host | password |
+------+--------------+----------+
| root | localhost | |
| root | rachel | |
| root | 127.0.0.1 | |
| root | ::1 | |
| | localhost | |
| | rachel | |
+------+--------------+----------+6 rows inset (0.00 sec)
MariaDB [(none)]> delete from mysql.user where user='';
Query OK, 2 rows affected (0.00 sec) #删除匿名用户MariaDB [(none)]> delete from mysql.user where user='root' and host='::1'; #删除IPv6方式登录用户
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> select user, host, password from mysql.user; #再次查看用户
+------+--------------+----------+
| user | host | password |
+------+--------------+----------+
| root | localhost | |
| root | rachel | |
| root | 127.0.0.1 | |
+------+--------------+----------+3 rows inset (0.00 sec)
MariaDB [(none)]> set password for root@localhost=password('XXXXXX'); #修改本地登录密码
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> set password for root@rachel=password('XXXXXX'); #修改本地登录密码
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> set password for root@'127.0.0.1'=password('XXXXXX'); #修改本地登录密码
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> select user, host, password from mysql.user; #查看密码
+------+--------------+-------------------------------------------+
| user | host | password |
+------+--------------+-------------------------------------------+
| root | localhost | *1728FCC102D8D1EB12BFXXXXXXXXXXXXXXXXXXX |
| root | rachel | *1728FCC102D8D1EB12BFXXXXXXXXXXXXXXXXXXX |
| root | 127.0.0.1 | *1728FCC102D8D1EB12BFXXXXXXXXXXXXXXXXXXX |
+------+--------------+-------------------------------------------+3 rows inset (0.00 sec)
MariaDB [(none)]> exit#退出
Bye
[root@rachel ~]# mysql -u root -p #再次用密码登录测试
Enter password:
Welcome tothe MariaDB monitor. Commands endwith ; or \g.
Your MariaDB connection idis4
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)]> exit
Bye
[root@rachel ~]# #测试成功
以上就介绍了CentOS7安装Apache+PHP+MariaDB,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
推荐阅读
-
Win10系统安装Paint 3D后怎么使用经典画图工具?
-
从安装到使用springboot集成RocketMq4.5.2
-
AutoCAD Electrical2013中文破解版怎么安装?AutoCAD Electrical 2013破解版安装步骤
-
谷歌浏览器(chrome)的免费插件时空隧道安装与使用图文教程
-
浩辰GstarCAD 2018无限试用补丁激活破解安装教程(附下载)
-
如何查看jdk是否安装成功(检测jdk安装成功的方法)
-
Oracle10g 安装方法
-
Python中文分词实现方法(安装pymmseg)
-
Oracle 安装和卸载问题收集(集合篇)第1/6页
-
Linux中安装Python的交互式解释器IPython的教程