实践1:
恩考: 怎么把lamp分开,把mysql单独做一台,apache+php又单独一台
1.
apache+php的那台编译时,也需要先编译mysql,但是可以不用它;
然后在另一台上重新再编译mysql(编译参数,配置文件,端口号,socket路径尽量不要改)
=====================================================================
2.然后在apache+php的这台上,修改php.ini里对应的相关参数
vim /usr/local/lib/php.ini
mysqli.default_port
mysqli.default_socket
mysqli.default_host
mysqli.default_user
mysqli.default_pw
--这些参数就是指定php连接的数据的IP,端口和socket等参数
=====================================================================
3.授权,测试是否能连接MySQL
mysql> create database phpwind;
Query OK, 1 row affected (0.00 sec)
mysql> grant all on phpwind.* to 'phpwind'@'192.168.0.101' identified by '123';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> select user,host,password from mysql.user;
+---------+------------------+-------------------------------------------+
| user | host | password |
+---------+------------------+-------------------------------------------+
| root | localhost | *23AE809DDACAF96AF0FD78ED04B6A265E05AA257 |
| root | test2.oracle.com | |
| root | 127.0.0.1 | |
| | localhost | |
| | test2.oracle.com | |
| phpwind | 192.168.0.101 | *23AE809DDACAF96AF0FD78ED04B6A265E05AA257 |
[root@test1 ~]# /usr/local/mysql/bin/mysql -h 192.168.0.102 -u phpwind -p123 -P3307
最后就是装论坛时会有选填mysql服务器IP(填上远端mysql的IP地址,但要求授权能登录,最好是先用mysql这个命令登录试一下)
=====================================================================
4,测试验证
注意,因为在安装MySQL的服务器上修改了默认的3306端口为3307,
所以在phpwind填写主机信息的时候“数据库服务器:192.168.0.102:3307”