尝试运行我的 Joomla 网站时出现此错误:
Access denied for user 'testuser'@'localhost' (using password: YES)
我刚刚将 Joomla 4 网站从一个 VPS 移至这个新 VPS。旧 MySQL 版本为 5.7。新版本为 8.0。此外,在我上一个 VPS 上 PHP 的版本为 8.0。新版本为 8.1。
我在新VPS中创建了数据库,并通过putty/console登录,通过mysql SOURCE安装了数据库。
这导致了上述问题,所以我尝试通过 phpMyAdmin 导入数据库。导入没有问题。
网页顶部还写道:
mysqli object is not fully initialized
我不确定我遗漏了什么。我还安装了 letsencryps ssl,但它似乎也不起作用。
结束语:我刚刚尝试使用root
用户,网站运行正常。因此,GRANT
使用 时,网站无法打开的权限就是这个testuser
。有什么办法可以解决这个问题或授予testuser
完整GRANT
权限吗?
还会产生一些错误:
Error:
mysqli object is not fully initialized
at /var/www/public_html/mywebsitedomain.com/libraries/vendor/joomla/database/src/Mysqli/MysqliStatement.php:137
at mysqli->prepare()
(/var/www/public_html/mywebsitedomain.com/libraries/vendor/joomla/database/src/Mysqli/MysqliStatement.php:137)
at Joomla\Database\Mysqli\MysqliStatement->__construct()
(/var/www/public_html/mywebsitedomain.com/libraries/vendor/joomla/database/src/Mysqli/MysqliDriver.php:1089)
at Joomla\Database\Mysqli\MysqliDriver->prepareStatement()
(/var/www/public_html/mywebsitedomain.com/libraries/vendor/joomla/database/src/DatabaseDriver.php:1900)
at Joomla\Database\DatabaseDriver->setQuery()
(/var/www/public_html/mywebsitedomain.com/libraries/src/Menu/SiteMenu.php:166)
at Joomla\CMS\Menu\SiteMenu->Joomla\CMS\Menu\{closure}()
(/var/www/public_html/mywebsitedomain.com/libraries/src/Cache/Controller/CallbackController.php:51)
at Joomla\CMS\Cache\Controller\CallbackController->get()
(/var/www/public_html/mywebsitedomain.com/libraries/src/Menu/SiteMenu.php:179)
at Joomla\CMS\Menu\SiteMenu->load()
(/var/www/public_html/mywebsitedomain.com/libraries/src/Menu/AbstractMenu.php:333)
at Joomla\CMS\Menu\AbstractMenu->getMenu()
(/var/www/public_html/mywebsitedomain.com/libraries/src/Menu/AbstractMenu.php:164)
at Joomla\CMS\Menu\AbstractMenu->getItem()
(/var/www/public_html/mywebsitedomain.com/libraries/src/Application/SiteApplication.php:422)
at Joomla\CMS\Application\SiteApplication->getTemplate()
(/var/www/public_html/mywebsitedomain.com/libraries/src/Error/Renderer/HtmlRenderer.php:50)
at Joomla\CMS\Error\Renderer\HtmlRenderer->render()
(/var/www/public_html/mywebsitedomain.com/libraries/src/Exception/ExceptionHandler.php:121)
at Joomla\CMS\Exception\ExceptionHandler::render()
(/var/www/public_html/mywebsitedomain.com/libraries/src/Exception/ExceptionHandler.php:72)
at Joomla\CMS\Exception\ExceptionHandler::handleException()
(/var/www/public_html/mywebsitedomain.com/libraries/src/Application/CMSApplication.php:322)
at Joomla\CMS\Application\CMSApplication->execute()
(/var/www/public_html/mywebsitedomain.com/includes/app.php:61)
at require_once('/var/www/public_html/mywebsitedomain.com/includes/app.php')
(/var/www/public_html/mywebsitedomain.com/index.php:32)
[1/2] mysqli_sql_exception
mysqli_sql_exception:
Access denied for user 'TheDrumCoach'@'localhost' (using password: YES)
at /var/www/public_html/mywebsitedomain.com/libraries/vendor/joomla/database/src/Mysqli/MysqliDriver.php:310
at mysqli->real_connect()
(/var/www/public_html/mywebsitedomain.com/libraries/vendor/joomla/database/src/Mysqli/MysqliDriver.php:310)
at Joomla\Database\Mysqli\MysqliDriver->connect()
(/var/www/public_html/mywebsitedomain.com/libraries/vendor/joomla/session/src/Handler/DatabaseHandler.php:233)
at Joomla\Session\Handler\DatabaseHandler->open()
at session_start()
(/var/www/public_html/mywebsitedomain.com/libraries/vendor/joomla/session/src/Storage/NativeStorage.php:478)
at Joomla\Session\Storage\NativeStorage->start()
(/var/www/public_html/mywebsitedomain.com/libraries/src/Session/Storage/JoomlaStorage.php:295)
at Joomla\CMS\Session\Storage\JoomlaStorage->start()
(/var/www/public_html/mywebsitedomain.com/libraries/vendor/joomla/session/src/Session.php:406)
at Joomla\Session\Session->start()
(/var/www/public_html/mywebsitedomain.com/libraries/vendor/joomla/session/src/Session.php:333)
at Joomla\Session\Session->has()
(/var/www/public_html/mywebsitedomain.com/libraries/src/Session/Session.php:194)
at Joomla\CMS\Session\Session->get()
(/var/www/public_html/mywebsitedomain.com/libraries/src/Factory.php:374)
at Joomla\CMS\Factory::getUser()
(/var/www/public_html/mywebsitedomain.com/libraries/src/Application/SiteApplication.php:562)
at Joomla\CMS\Application\SiteApplication->initialiseApp()
(/var/www/public_html/mywebsitedomain.com/libraries/src/Application/SiteApplication.php:226)
at Joomla\CMS\Application\SiteApplication->doExecute()
(/var/www/public_html/mywebsitedomain.com/libraries/src/Application/CMSApplication.php:293)
at Joomla\CMS\Application\CMSApplication->execute()
(/var/www/public_html/mywebsitedomain.com/includes/app.php:61)
at require_once('/var/www/public_html/mywebsitedomain.com/includes/app.php')
(/var/www/public_html/mywebsitedomain.com/index.php:32)
答案1
如果目标是以testuser
与 相同级别的权限进行操作root
,那么您可以从 MySQL 内部执行以下操作:
GRANT ALL PRIVILEGES ON `joomladb`.* TO `testuser`@`localhost`
笔记:请务必joomladb
用数据库的实际名称替换。
您的错误日志显示不同的帐户名失败,因此,如果多个帐户需要完全访问此数据库,请确保为每个帐户运行一次。