安装 MySQL phpMyAdmin cpolar实现远程访问连接
warning:
这篇文章距离上次修改已过222天,其中的内容可能已经有所变动。
为了在任何远程位置通过互联网连接到phpMyAdmin,并使用cpolar进行内网穿透,你需要按照以下步骤操作:
- 安装MySQL数据库:
sudo apt update
sudo apt install mysql-server
- 安装phpMyAdmin:
sudo apt update
sudo apt install phpmyadmin
配置phpMyAdmin以允许远程连接(可选,通常phpMyAdmin不建议在生产环境中允许远程连接):
编辑
/etc/php/7.x/apache2/php.ini
(x为你的PHP版本),找到allow_url_include = Off
并更改为allow_url_include = On
。配置MySQL允许远程连接:
编辑
/etc/mysql/mysql.conf.d/mysqld.cnf
,注释掉bind-address = 127.0.0.1
:
# bind-address = 127.0.0.1
- 重启MySQL和Apache服务:
sudo systemctl restart mysql
sudo systemctl restart apache2
- 设置MySQL用户权限允许远程连接:
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
- 安装cpolar:
curl -L https://www.cpolar.com/static/downloads/cpolar-stable-linux-amd64 -o cpolar
chmod +x cpolar
./cpolar install
- 创建隧道连接phpMyAdmin:
./cpolar tcp 80
- 使用cpolar提供的公网地址连接phpMyAdmin。
注意:确保你的MySQL和phpMyAdmin配置是安全的,不要在生产环境中允许无限制的远程连接。使用cpolar时,请确保你的互联网连接是安全的,因为隧道的数据将通过公共互联网进行传输。
评论已关闭