Centos7.0安装lampp,解决mysql无法远程连接

S1:下载xampp

进入用户目录,创建文件,使用weget下载xampp到文件夹下

# wget  https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/7.0.24/xampp-linux-x64-7.0.24-0-installer.run

S2:安装xampp

首选赋予安装文件可执行权限,执行命令:# chmod 777 xampp-linux-x64-7.0.24-0-installer.run

运行:./xampp-linux-x64-7.0.24-0-installer.run 进行安装操作。根据提示进行安装即可,不熟悉的话可以按照默认选择yes一直下去。

看到100%说明安装成功。

安装完成之后的,目录在 /opt/lampp 

常见的lampp命令

启动xampp:
# /opt/lampp/lampp start
停止xampp:
# /opt/lampp/lampp stop

重启xampp

# /opt/lampp/lampp restart

S3:设置相关密码

执行命令# /opt/lampp/lampp security

设置xampp的密码: 
XAMPP: Quick security check… 
XAMPP: Your XAMPP pages are NOT secured by a password. 
XAMPP: Do you want to set a password? [yes] yew 
XAMPP: Do you want to set a password? [yes] yes 
XAMPP: Password: 
XAMPP: Password (again):
用户名默认是:xampp
设置phpMyAdmin的密码: 
XAMPP: The MySQL/phpMyAdmin user pma has no password set!!! 
XAMPP: Do you want to set a password? [yes] yes 
XAMPP: Password: 
XAMPP: Password (again): 
XAMPP: Setting new MySQL pma password. 
XAMPP: Setting phpMyAdmin’s pma password to the new one.
设置mysql的root账户: 
XAMPP: MySQL has no root passwort set!!! 
XAMPP: Do you want to set a password? [yes] yes 
XAMPP: Write the password somewhere down to make sure you won’t forget it!!! 
XAMPP: Password: 
XAMPP: Password (again): 
XAMPP: Setting new MySQL root password. 
XAMPP: Change phpMyAdmin’s authentication method.
设置ftp密码: 
XAMPP: The FTP password for user ‘daemon’ is still set to ‘xampp’. 
XAMPP: Do you want to change the password? [yes] yes 
XAMPP: Password: 
XAMPP: Password (again):

S4:修改外网访问权限

找到配置文件:

/opt/lampp/etc/extra/httpd-xampp.conf

修改17行的内容如下:

# since XAMPP 1.4.3
<Directory "/opt/lampp/phpmyadmin">
    AllowOverride AuthConfig Limit
   
Require  all granted 
    ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>

S5:修改MYsql外网访问权限

这步折腾了我好久,原因是没注释掉my.cnf的 skip networking,导致怎么外网访问都不行。

执行命令

#/opt/lampp/bin/mysql -u root -p

Enter password: 
切换数据库
mysql> use mysql;
修改外网访问
查看用户
select host ,user from user;
//赋予任何主机访问数据的权限
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
//使修改生效
mysql>FLUSH PRIVILEGES;

重启mysql,问题解决。

S5:配置反向代理

修改/opt/lampp/etc/httpd.conf

# Virtual hosts
Include etc/extra/httpd-vhosts.conf

开启反向代理

修改代理配置文件/opt/lampp/etc/extra/httpd-vhosts.conf

//按照如下配置换一下IP和域名

<VirtualHost *:80>
    ServerName 101.101.161.133
    ProxyPreserveHost On  
    ProxyRequests Off  
    ProxyPass / http://101.101.161.133:8080/
    ProxyPassReverse / http://101.101.161.133:8080/
    ErrorLog logs/smart119_error_log
    CustomLog logs/smart119_custom_log common
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot "/opt/lampp/docs/dummy-host.example.com"
#    ServerName dummy-host.example.com
#    ServerAlias www.dummy-host.example.com
#    ErrorLog "logs/dummy-host.example.com-error_log"
#    CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>


<VirtualHost *:80>
    ServerName abc.rleit.com
    ProxyPreserveHost On  
    ProxyRequests Off  
    ProxyPass / http://101.101.161.133:8080/
    ProxyPassReverse / http://101.101.161.133:8080/
    ErrorLog logs/smart119_error_log
    CustomLog logs/smart119_custom_log common
#    ServerAdmin webmaster@dummy-host2.example.com
#    DocumentRoot "/opt/lampp/docs/dummy-host2.example.com"
#    ServerName dummy-host2.example.com
#    ErrorLog "logs/dummy-host2.example.com-error_log"
#    CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>




  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值