数据库软件操作

2021-10-25 76

使用积累

  • 登录数据库过程中,如果遇到忘记root密码时,该如何解决/ 登录别人的莫得密码

net stop mysql
mysqld --shared-memory --skip-grant-tables
mysql -uroot -p
update user set authentication_string='123456' where user='root';
(mysql8.0以上: 有两条以前的命令不生效)
alter user 'root'@'localhost' identified by 'newpassword'; newpassword是要设的新密码。
flush privileges;

  • MySQL Workbench8.0中,忘记MySQL root密码的情况下修改密码
    https://www.cnblogs.com/slyblue/p/12976802.html

    • 清理时,可能会有报错 Failed to find valid data directory https://blog.csdn.net/guyue35/article/details/107828255

Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client at Handshake.Sequence._packetToError
解决:(修改加密规则为普通模式,默认是严格加密模式)

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
// 'password'是你的数据库密码

mysql bench 导出ER图