Skip to content

[MySQL]修改默认密码 #21

@vagabond1-1983

Description

@vagabond1-1983

前提:windows平台

mysql -u root
mysql>set password for 'root'@'localhost'=password('newpasswd");

设置之后root的密码将变为newpasswd。这样就完成了根用户root密码的设置工作。

之前没有用-u root,进入root账户时,发现无法看到mysql库。
因为通过
mysql>show CURRENT_USER();
可以看到,当前的用户是ODBC@localhost,而非root
所以,需要用root账户启动mysql命令行

另外比较有用的语句
mysql>show DATABASE();
mysql>show USER();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions