LAMP多機方案實戰中的問題

1.LAMP多機方案搭建場景 mysql

image.pngimage.pngimage.png

2.搭建、調式、測試環境場景中應該注意的技能redis

1)將虛擬機上的142主機成功克隆出141主機後,將新的主機從新設置新的IP(192.168.153.141)地址.sql

2)將141主機更改主機名,如#hostnamectl set-hostname LAMP數據庫

3)將143數據庫服務器中的論壇數據庫受權給141主機,不然出現如下錯誤,以下圖所示:apache

image.png

4)現將解決沒法鏈接數據庫服務器(192.168.153.143)的問題: 服務器

[root@sky9890]# mysql  -uroot  -p dom

Enter password: ide

MySQL [(none)]> use mysql;
學習

Database changed測試

MySQL [mysql]> select Host  from user where user='root';

+-----------------------+

| Host                  |

+-----------------------+

| 127.0.0.1             |

| 192.168.153.142       |

| ::1                   |

| localhost             |

| localhost.localdomain |

+-----------------------+

MySQL [mysql]> GRANT ALL ON *.* to root@'192.168.153.141' IDENTIFIED BY '*****';  #受權

MySQL [mysql]> flush privileges;

MySQL [mysql]> select Host  from user where user='root';                           

+-----------------------+

| Host                  |

+-----------------------+

| 127.0.0.1             |

| 192.168.153.141       |

| 192.168.153.142       |

5)成功測試,以下圖:

image.png

6)啓動服務器時,就要自動啓動必要的服務,因此平時學習時就要按工做要求、職業素養來訓練。

[root@lamp sky9890]# cat  /etc/rc.local 

/usr/local/apache2/bin/apachectl  #apache服務

[sky9890@redis_master ~]$ ll  /etc/rc.d/rc.local 

-rw-r--r--. 1 root root 506 1月  17 14:40 /etc/rc.d/rc.local

[root@lamp sky9890]# chmod +x /etc/rc.d/rc.local  #必須授予執行

相關文章
相關標籤/搜索