作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是我第一次运行宝塔盒子。我有一个 PHP 应用程序。它需要使用MySQL数据库。我已经上传了所有代码。我还创建了安全隧道连接。但是当我尝试连接到数据库时,出现了一些问题。我无法加载数据库。它甚至没有给我任何错误。
这是我的代码
$this->load->database();
echo 'here';
$db['default']['hostname'] = 'tunnel.pagodabox.com:3306';
$db['default']['username'] = 'xxxx';
$db['default']['password'] = 'xxxx';
$db['default']['database'] = 'blog';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
$db['default']['port'] = 45000;
顺便说一句,我的 MySQL 数据库运行在端口 3306 上,隧道运行在 45000 上。
最佳答案
假设您正在尝试从本地计算机连接到 pagodabox 中的 mysql 数据库。
1.从桌面保护数据库隧道。如果连接成功,您可能会得到类似的信息。
Tunnel Established! Accepting connections on :
-----------------------------------------------
HOST : 127.0.0.1 (or localhost)
PORT : 3307
USER : (found in pagodabox dashboard)
PASS : (found in pagodabox dashboard)
2.本地codeigniter应用连接到pagodabox mysql
<罢工>
<罢工> $this->load->database();
echo 'here';
<罢工>
$db['default']['hostname'] = '127.0.0.1';
$db['default']['username'] = 'xxxx';
$db['default']['password'] = 'xxxx';
$db['default']['database'] = 'blog';
..
..
$db['default']['port'] = 3307; // This one matches with Port displayed above.
</pre>
要查看错误,请打开index.php文件并设置错误报告E_ALL
if (defined('ENVIRONMENT'))
{
switch (ENVIRONMENT)
{
case 'development':
error_reporting(E_ALL);
break;
case 'testing':
case 'production':
error_reporting(0);
break;
default:
exit('The application environment is not set correctly.');
}
}
error_reporting(E_ALL);
关于php - 宝塔盒子无法使用MySQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21672882/
宝塔面板如何设置自定义 404 页面?大家知道,默认的 404 页面对搜索引擎不友好,那怎么通过宝塔面板修改默认的 404 页面,使之变成我们自定义的 404 页面呢。 1、进入宝塔面板,找到对应
所以,我的应用程序位于 this link 我可以使用 Pagoda 客户端创建隧道,并且可以通过 mySQL CLI 查看数据库。该命令是 mysql -u -p -htunnel.pagodabo
我是一名优秀的程序员,十分优秀!