我已经安装了mysql 5.7.18。安装后,root
用户的密码为null
。
我已尝试mysql_secure_instattation
并按照查询重置密码。
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyPassword';
和
UPDATE mysql.user
SET authentication_string = PASSWORD('MyPassword'), password_expired = 'N'
WHERE User = 'root' AND Host = 'localhost';
FLUSH PRIVILEGES;
这些方法成功执行但仍然是mysql root用户连接NULL
密码。
我该怎么办?
答案 0 :(得分:0)
更改用户'root'@'localhost'通过'MyNewPass'识别;
C:\> cd "C:\Program Files\MySQL\MySQL Server 5.7\bin" C:\> mysqld --init-file=C:\\mysql-init.txt
注意:如果您使用的是MySQL 5.7.5及更早版本,请使用以下命令更改命令行:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');
答案 1 :(得分:0)
您也可以使用以下命令更新MySQL密码:
Description:
Parameter 0 of constructor in com.mportal.ec.error.DefaultExceptionHandler required a single bean, but 2 were found:
- linkRelationMessageSource: defined by method 'linkRelationMessageSource' in class path resource [org/springframework/hateoas/config/HateoasConfiguration.class]
- resourceDescriptionMessageSourceAccessor: defined by method 'resourceDescriptionMessageSourceAccessor' in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]
Action:
Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed
答案 2 :(得分:0)
这是由于MySQL对root用户使用unix_socket
插件而不是mysql_native_password
插件,这意味着mysql信任Linux root用户的凭据。如果您以Linux超级用户登录,则MySQL不会要求提供MySQL超级用户的安全凭证。因此,即使成功地为MySQL根用户更改了密码,它也仍然没有密码连接。