无法使用新的管理员帐户连接 MySQL 服务器

无法使用新的管理员帐户连接 MySQL 服务器

当我在 Windows 10 中升级到 MySQL 服务器 8.0.15 时,我创建了一个新的管理员帐户。

但是,我无法使用 mysql -u root -p 登录服务器。因此,我尝试使用新创建的用户帐户并尝试启动服务器。以下是我所做的事情:-

C:\Program Files\MySQL\MySQL Server 8.0.15\bin>mysql -u -p
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

C:\Program Files\MySQL\MySQL Server 8.0.15\bin>net start mysql
The service name is invalid.

More help is available by typing NET HELPMSG 2185.


C:\Program Files\MySQL\MySQL Server 8.0.15\bin>mysqld install
Service successfully installed.

C:\Program Files\MySQL\MySQL Server 8.0.15\bin>mysql -u -p
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

C:\Program Files\MySQL\MySQL Server 8.0.15\bin>net start mysql
The MySQL service is starting.
The MySQL service could not be started.

The service did not report an error.

More help is available by typing NET HELPMSG 3534.


C:\Program Files\MySQL\MySQL Server 8.0.15\bin>mysqld --initialize

C:\Program Files\MySQL\MySQL Server 8.0.15\bin>net start mysql
The MySQL service is starting....
The MySQL service was started successfully.


C:\Program Files\MySQL\MySQL Server 8.0.15\bin>mysql -u -p
ERROR 1045 (28000): Access denied for user '-p'@'localhost' (using password: NO)

C:\Program Files\MySQL\MySQL Server 8.0.15\bin>mysql -u root -p
Enter password: ********
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

C:\Program Files\MySQL\MySQL Server 8.0.15\bin>mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

C:\Program Files\MySQL\MySQL Server 8.0.15\bin>mysqladmin -u root password [newpassword]
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'


C:\Program Files\MySQL\MySQL Server 8.0.15\bin>mysql GRANT ALL PRIVILEGES ON *.* TO 'abc'@'localhost' IDENTIFIED BY 'x123';
mysql  Ver 8.0.15 for Win64 on x86_64 (MySQL Community Server - GPL)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.

Usage: mysql [OPTIONS] [database]
  -?, --help          Display this help and exit.
  -I, --help          Synonym for -?
  --auto-rehash       Enable automatic rehashing. One doesn't need to use
                      'rehash' to get table and field completion ....

我已经为此挣扎了好几个小时,但我一点也不知道该如何让我的连接正常工作。任何帮助我都非常感谢。谢谢。

相关内容