mysql> 使用 mysql; 但是......错误1044(42000):用户''@'localhost'对数据库'mysql'的访问被拒绝

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30250758/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 21:00:56  来源:igfitidea点击:

mysql> use mysql; but ... ERROR 1044 (42000): Access denied for user '' @ 'localhost' to database 'mysql'

mysqldatabase

提问by yuri90

using mysql.exe I enter the command mysql> use mysql; but there is an error:

使用 mysql.exe 我输入命令 mysql> use mysql; 但有一个错误:

ERROR 1044 (42000): Access denied for user '' @ 'localhost' to database 'mysql'

错误 1044 (42000):用户 ''@'localhost' 对数据库 'mysql' 的访问被拒绝

  • What does this mean?
  • How so I can access a mysql database?
  • The most important thing is that I want to reset password mysql database, but an error occurs when I enter the command: mysql> use mysql;
  • 这是什么意思?
  • 我如何才能访问 mysql 数据库?
  • 最重要的是我想重置mysql数据库的密码,但是输入命令时出现错误:mysql> use mysql;

回答by yuri90

thanks all, finally I found this reset root password with wrong mysql config… and it works well for me :)

谢谢大家,最后我发现这个 重置 root 密码的 mysql 配置错误......它对我来说效果很好:)

-Go to your xampp\mysql\bin\ folder
-Edit my.ini and insert skip-grant-tablesbelow [mysqld]
-Restart MySQL
-Set new password for your root user by running UPDATE mysql.user SET Password=PASSWORD('new_password') WHERE User='root'in phpMyAdmin in the mysql database (or just leave it like this if MySQL cannot be accessed from remote hosts)

-转到您的 xampp\mysql\bin\ 文件夹 -
编辑 my.ini 并在[mysqld]下面插入skip-grant-tables- 重新启动 MySQL - 通过运行UPDATE mysql.user SET Password=PASSWORD(' new_password') WHERE User='root'in phpMyAdmin in the mysql 数据库(或者如果 MySQL 无法从远程主机访问,就保持这样)

AndreKR

安德烈KR

回答by Sherlock

Grant all privileges to the user first ,

首先授予用户所有权限,

GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost' WITH GRANT OPTION;

回答by Krishna

Open MySQL interface (phpMyadmin) through browser then

通过浏览器打开 MySQL 界面 (phpMyadmin) 然后

  1. click Users
  2. check users with grant options if it is no then follow below steps
  3. click->edit privileges (if user with 'no' grant option)
  4. then select (global privileges) mark check all
  5. continue these steps to all users
  1. 点击用户
  2. 如果不是,请检查具有授权选项的用户,然后按照以下步骤操作
  3. 单击-> 编辑权限(如果用户具有“否”授予选项)
  4. 然后选择(全局权限)标记检查所有
  5. 对所有用户继续这些步骤