CentOS7安裝Apache+PHP+MariaDB

WBOY
發布: 2016-07-29 09:15:08
原創
1426 人瀏覽過

首先,安裝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
登入後複製

rereee

設定兩個服務自動啟動

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教學有興趣的朋友有幫助。

🎜
相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新問題
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!