为什么迁移到 VPS 的项目对数据库的任何请求都会出现错误 500?

请告诉我,为什么迁移到 VPS 的项目对数据库的任何请求都会陷入错误 500?在此之前,该项目处于正常托管状态并且运行没有问题。

https://img1.sycdn.imooc.com/65aa269d000184be16800057.jpg

[Mon Sep 14 14:19:43.031257 2020] [php7:notice] [pid 25463] [client 77.93.52.193:46222] PHP 注意:未定义索引:在线 /var/www/project/includes/model.php 中记录了用户11

[Mon Sep 14 14:19:43.031654 2020] [php7:notice] [pid 25463] [client 77.93.52.193:46222] PHP 注意:尝试获取 /var/www/project/ 中非对象的属性“id” include/model.php 第 11 行

[Mon Sep 14 14:19:43.033118 2020] [php7:error] [pid 25463] [client 77.93.52.193:46222] PHP 致命错误:未捕获 [3D000] - SQLSTATE[3D000]:无效的目录名称:1046 未选择数据库\ntrace: #0 /var/www/project/includes/redbean-orm.php(882): RedBeanPHP\Driver\RPDO->runQuery('SELECT users....', Array)\n#1 /var/www /linkmarky/includes/redbean-orm.php (3466): RedBeanPHP\Driver\RPDO->GetAll('SELECT users....', Array)\n#2 /var/www/linkmarky/includes/redbean-orm. php(5177): RedBeanPHP\Adapter\DBAdapter->get('SELECT users, Array)\n#3 /var/www/linkmarky/includes/redbean-orm.php(7172): RedBeanPHP\QueryWriter\AQueryWriter->queryRecord( 'users', Array, ' WHERE id = ? L...', Array)\n#4 var/www/project/includes/redbean-orm.php(8255): RedBeanPHP\Repository->find('users' ,数组,'id =?LIMIT 1',数组)\n#5 /var/www/project/includes/redbean-orm.php(8665): RedBeanPHP ... /var/www/project/includes/redbean- orm.php(10854): RedBeanPHP\Finder->findOne('u 在 /var/www/project/includes/redbean-orm.php 第 720 行

https://img1.sycdn.imooc.com/65aa26b300011e5507470193.jpg

https://img1.sycdn.imooc.com/65aa26bb0001d2ec02240205.jpg

翻阅古今
浏览 94回答 1
1回答

慕莱坞森

截止错误似乎是没有选择数据库。查看 RedBeanPHP 文档:连接文档 看起来您的连接字符串出现了错误。连接字符串应如下所示(注意dbname=): R::setup( 'mysql:host=localhost;dbname=mydatabase',          'user', 'password' ); //for both mysql or mariaDB
打开App,查看更多内容
随时随地看视频慕课网APP