简体   繁体   English

ERROR 1045(28000):用户'root'@'localhost'拒绝访问(使用密码:NO)

[英]ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

I lost the access onto MySQL v. 5.6.14. 我无法访问MySQL v.5.6.14。 I had access and suddenly I lost it. 我有权进入,突然间我失去了它。

Looking for notes I found out the url below. 寻找笔记我发现下面的网址。 I did the steps, but not success. 我做了一些步骤,但没有成功。 http://dev.mysql.com/doc/refman/5.5/en/resetting-permissions.html http://dev.mysql.com/doc/refman/5.5/en/resetting-permissions.html

C:\\Program Files\\MySQL\\bin>mysqld C:\\ Program Files \\ MySQL \\ bin> mysqld

2013-11-14 19:46:01 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. 2013-11-14 19:46:01 0 [警告]不推荐使用具有隐式DEFAULT值的TIMESTAMP。 Please use --explicit_defaults_for_timestamp server option (see documentation for more details) 请使用--explicit_defaults_for_timestamp服务器选项(有关详细信息,请参阅文档)

C:\\Program Files\\MySQL\\bin>mysql -u root mysql1 C:\\ Program Files \\ MySQL \\ bin> mysql -u root mysql1

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) ERROR 1045(28000):用户'root'@'localhost'拒绝访问(使用密码:NO)

Notice: I don't have mysqld_safe or safe_mysqld files in MySQL version 注意:MySQL版本中没有mysqld_safesafe_mysqld文件

Could you please help me? 请你帮助我好吗? Below you can see the dump file generated by the command: 您可以在下面看到该命令生成的转储文件:

C:\mysqld --init-file=C:\\mysql-init.txt

C:\Program Files\MySQL\bin>mysqld --init-file=C:\\mysql-init.txt --console

2013-11-14 17:57:20 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.     Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-11-14 17:57:20 5180 [Note] Plugin 'FEDERATED' is disabled.
2013-11-14 17:57:20 5180 [Note] InnoDB: The InnoDB memory heap is disabled
2013-11-14 17:57:20 5180 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked     functions
2013-11-14 17:57:20 5180 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-11-14 17:57:20 5180 [Note] InnoDB: Not using CPU crc32 instructions
2013-11-14 17:57:20 5180 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2013-11-14 17:57:20 5180 [Note] InnoDB: Completed initialization of buffer pool
2013-11-14 17:57:20 5180 [ERROR] InnoDB: .\ibdata1 can't be opened in read-write mode
2013-11-14 17:57:20 5180 [ERROR] InnoDB: The system tablespace must be writable!
2013-11-14 17:57:20 5180 [ERROR] Plugin 'InnoDB' init function returned error.
2013-11-14 17:57:20 5180 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2013-11-14 17:57:20 5180 [ERROR] Unknown/unsupported storage engine: InnoDB
2013-11-14 17:57:20 5180 [ERROR] Aborting
2013-11-14 17:57:20 5180 [Note] Binlog end
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'partition'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_METRICS'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_CMPMEM'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_CMP'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_LOCKS'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'INNODB_TRX'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'BLACKHOLE'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'ARCHIVE'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'MRG_MYISAM'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'MyISAM'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'MEMORY'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'CSV'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'sha256_password'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'mysql_old_password'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'mysql_native_password'
2013-11-14 17:57:20 5180 [Note] Shutting down plugin 'binlog'
2013-11-14 17:57:20 5180 [Note] mysqld: Shutdown complete

C:\Program Files\MySQL\bin>

I had the same problem. 我有同样的问题。 mysql -u root -p worked for me. mysql -u root -p为我工作。 It later asks you for a password. 它稍后会要求您输入密码。 You should then enter the password that you had set for mysql. 然后,您应该输入为mysql设置的密码。 The default password could be password , if you did not set one. 如果您没有设置password ,则默认密码可以是password More info here . 更多信息在这里

Follow the steps given below: 请按照以下步骤操作:

  1. Stop your MySQL server completely. 完全停止MySQL服务器。 This can be done by accessing the Services window inside Windows XP and Windows Server 2003, where you can stop the MySQL service. 这可以通过访问Windows XP和Windows Server 2003中的“服务”窗口来完成,您可以在其中停止MySQL服务。

  2. Open your MS-DOS command prompt using "cmd" inside the Run window. 在“运行”窗口中使用“cmd”打开MS-DOS命令提示符。 Inside it navigate to your MySQL bin folder, such as C:\\MySQL\\bin using the cd command. 在里面它使用cd命令导航到你的MySQL bin文件夹,例如C:\\ MySQL \\ bin。

  3. Execute the following command in the command prompt: mysqld.exe -u root --skip-grant-tables 在命令提示符中执行以下命令: mysqld.exe -u root --skip-grant-tables

  4. Leave the current MS-DOS command prompt as it is, and open a new MS-DOS command prompt window. 保持当前的MS-DOS命令提示符,并打开一个新的MS-DOS命令提示符窗口。

  5. Navigate to your MySQL bin folder, such as C:\\MySQL\\bin using the cd command. 使用cd命令导航到您的MySQL bin文件夹,例如C:\\ MySQL \\ bin。

  6. Enter mysql and press enter. 输入mysql并按Enter键。

  7. You should now have the MySQL command prompt working. 您现在应该可以使用MySQL命令提示符。 Type use mysql; 输入use mysql; so that we switch to the "mysql" database. 这样我们就切换到了“mysql”数据库。

  8. Execute the following command to update the password: 执行以下命令更新密码:

     UPDATE user SET Password = PASSWORD('NEW_PASSWORD') WHERE User = 'root'; 

However, you can now run any SQL command that you wish. 但是,您现在可以运行任何您希望的SQL命令。

After you are finished close the first command prompt and type exit; 完成后,关闭第一个命令提示符并键入exit; in the second command prompt windows to disconnect successfully. 在第二个命令提示符窗口中成功断开连接。 You can now start the MySQL service. 您现在可以启动MySQL服务。

Your problem is here: 你的问题在这里:

2013-11-14 17:57:20 5180 [ERROR] InnoDB: .\ibdata1 can't be opened in read-write mode

There's some problem with the ibdata1 file - maybe the permissions have changed on it? ibdata1文件存在一些问题 - 可能是权限已经改变了吗? Perhaps some other process has it open. 也许其他一些过程是开放的。 Does it even exist? 它甚至存在吗?

Fix this and possibly everything else will fall into place. 解决这个问题,可能还有其他一切都会到位。

I encountered the same problem, probably when I uninstalled it and tried to install it again. 我遇到了同样的问题,可能是我卸载它并尝试再次安装它。 This happens because of the database file containing login details is still stored in the pc, and the new password will not match the older one. 发生这种情况是因为包含登录详细信息的数据库文件仍存储在PC中,并且新密码与旧密码不匹配。 So you can solve this by just uninstalling mysql, and then removing the left over folder from the C: drive (or wherever you must have installed). 所以你可以通过卸载mysql,然后从C:驱动器(或者你必须安装的任何地方)删除左侧文件夹来解决这个问题。

The following steps are to reset the password for a user in case you forgot, this would also solve your mentioned error. 以下步骤是为了忘记用户重置密码,这也将解决您提到的错误。

First, stop your MySQL: 首先,停止你的MySQL:

sudo /etc/init.d/mysql stop

Now start up MySQL in safe mode and skip the privileges table: 现在以安全模式启动MySQL并跳过权限表:

sudo mysqld_safe --skip-grant-tables &

Login with root: 用root登录:

mysql -uroot

And assign the DB that needs to be used: 并分配需要使用的数据库:

use mysql;

Now all you have to do is reset your root password of the MySQL user and restart the MySQL service: 现在您要做的就是重置MySQL用户的root密码并重启MySQL服务:

update user set password=PASSWORD("YOURPASSWORDHERE") where User='root';

flush privileges;

quit and restart MySQL: 退出并重启MySQL:

quit

sudo /etc/init.d/mysql stop sudo /etc/init.d/mysql start Now your root password should be working with the one you just set, check it with: sudo /etc/init.d/mysql stop sudo /etc/init.d/mysql start现在你的root密码应该与你刚设置的密码一起使用,检查一下:

mysql -u root -p

暂无
暂无

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

相关问题 错误1045(28000):用户'= root'@'localhost'的访问被拒绝(使用密码:否) - ERROR 1045 (28000): Access denied for user '=root'@'localhost' (using password: NO) ERROR 1045 (28000): 用户 'root'@'localhost' 访问被拒绝(使用密码:YES); 无法重设密码 - ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES); Can't reset password 错误 1045 (28000):拒绝用户 'lenovo'@'localhost' 的访问(使用密码:否) - ERROR 1045 (28000): Access denied for user 'lenovo'@'localhost' (using password: NO) 无法访问 MySQL:错误 1045 (28000):用户 'root'@'localhost' 的访问被拒绝(使用密码:是) - Cannot access MySQL : ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) Mysql 错误:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) - Mysql error: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) [root @ localhost〜]#mysql -u root -p输入密码:错误1045(28000):用户'root'@'localhost'的访问被拒绝(使用密码:是) - [root@localhost ~]# mysql -u root -p Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) Wamppserver 2.4错误1045(28000):用户'root'@'localhost'的访问被拒绝(使用密码:NO) - Wamppserver 2.4 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 错误 1045 (28000): 用户 'root'@'localhost' 访问被拒绝(使用密码:YES)-Ubuntu - ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) -Ubuntu 错误1045(28000):在Linux 16.04上对用户'root'@'localhost'的访问被拒绝(使用密码:是) - ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) on linux 16.04 错误 1045 (28000):Ubuntu(Zorin OS)上的用户 'root'@'localhost'(使用密码:YES)的访问被拒绝 - ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) on Ubuntu (Zorin OS)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM