简体   繁体   English

root 用户在本地主机中“锁定”phpmyadmin

[英]root user "locked" phpmyadmin in localhost

in localhost i have mistakenly click on "lock" option of "root" user of phpmyadmin then im getting " mysqli::real_connect(): (HY000/4151): Access denied, this account is locked" issue while trying to connect "localhost/phpmyadmin" again?在本地主机中,我错误地单击了 phpmyadmin 的“根”用户的“锁定”选项,然后我收到“mysqli::real_connect(): (HY000/4151): 访问被拒绝,此帐户被锁定”的问题,同时尝试连接“本地主机” /phpmyadmin”又来了? how can i resolve this issue?我该如何解决这个问题? Thanks谢谢

I have tried by changing "user" "password" "hostname" in "config.inc.php" file but nothing works!我尝试通过更改“config.inc.php”文件中的“用户”“密码”“主机名”但没有任何效果!

how can i resolve this issue?我该如何解决这个问题?

If you are running MySQL on a Mac or Linux variant, depending on which account is locked, you may still be able to connect with sudo mysql .如果您在 Mac 上运行 MySQL 或 Linux 变体,根据锁定的帐户,您可能仍然可以使用sudo mysql进行连接。 If so, you can run the UPDATE query (further down) to unlock the root account.如果是这样,您可以运行 UPDATE 查询(进一步向下)以解锁根帐户。 You will need to run FLUSH PRIVILEGES;您将需要运行FLUSH PRIVILEGES; or restart MySQL service for the change to take effect.或重启 MySQL 服务使修改生效。

If that does not work, or you are on Windows, you can use skip-grant-tables to start the service with the authentication disabled.如果这不起作用,或者您使用的是 Windows,则可以使用 skip-grant-tables 在禁用身份验证的情况下启动服务。 The location of the relevant configuration file varies with version and OS.相关配置文件的位置因版本和操作系统而异。

Typical location of configuration file for MySQL 8.0 on Windows - Windows 上 MySQL 8.0 配置文件的典型位置 -

C:\ProgramData\MySQL\MySQL Server 8.0\my.ini

MySQL on many Linux variants will check for -许多 Linux 变体上的 MySQL 将检查 -

/etc/my.cnf

If it does not exist check the typical location for your Linux variant.如果它不存在,请检查您的 Linux 变体的典型位置。 Add the skip-grant-tables option in the mysqld section -mysqld部分添加skip-grant-tables选项 -

[mysqld]
skip-grant-tables

Now you need to restart the MySQL service -现在你需要重启 MySQL 服务 -

# On Windows (cmd as admin)
net stop MYSQL80
net start MYSQL80

# or PowerShell as admin
Restart-Service -Name MYSQL80

# On Linux
sudo service mysql restart

You should now be able to connect to MySQL without needing credentials, and you can pass the UPDATE query in directly with --execute or -e .您现在应该能够连接到 MySQL 而无需凭据,并且您可以直接使用--execute-e传递 UPDATE 查询。

mysql -e "UPDATE `mysql`.`user` SET `account_locked` = 'N' WHERE `User` = 'root';"

And now you can reverse the configuration changes made above and restart MySQL service again.现在您可以撤销上面所做的配置更改并再次重新启动 MySQL 服务。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 修复 phpMyAdmin 用户 'root'@'localhost' 拒绝访问的问题 - Fix Access denied for user 'root'@'localhost' for phpMyAdmin 使用PHPMyAdmin拒绝用户“root”@“localhost”访问 - Access denied for user 'root'@'localhost' with PHPMyAdmin XAMPP PhpMyAdmin错误1045,“用户'root'@'localhost'的访问被拒绝 - XAMPP PhpMyAdmin Error 1045, "Access denied for user 'root'@'localhost' Wamp phpMyAdmin错误#1045 - 用户'root'@'localhost'拒绝访问 - Wamp phpMyAdmin error #1045 - Access denied for user 'root'@'localhost' 用户'root'@'localhost'的访问被拒绝(使用密码:是):PhpMyAdmin - Access denied for user 'root'@'localhost' (using password: YES): PhpMyAdmin 错误#1045-phpmyadmin中的用户'root'@'localhost'的访问被拒绝 - error #1045 - Access denied for user 'root'@'localhost' in phpmyadmin 为root添加了密码,锁定了phpmyadmin - Added password to root, locked out of phpmyadmin MySQL 8.0 ERROR 3118(HY000):用户'root'@'localhost'的访问被拒绝。 帐户被锁定 - MySQL 8.0 ERROR 3118 (HY000): Access denied for user 'root'@'localhost'. Account is locked 无法访问 phpmyadmin - 用户 'root'@'localhost' 访问被拒绝(使用密码:YES) - Can't access to phpmyadmin - Access denied for user 'root'@'localhost' (using password: YES) 用户 'root'@'localhost' 访问被拒绝(使用密码:YES),即使密码在 PhpMyAdmin 上有效 - Access denied for user 'root'@'localhost' (using password: YES) EVEN when the Password works on PhpMyAdmin
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM