Mysql免安装版设置密码教程详解
程序员文章站
2023-02-17 13:10:47
方法1: 用set password命令
mysql -u root
mysql> set password for 'root'@'localho...
方法1: 用set password命令
mysql -u root mysql> set password for 'root'@'localhost' = password('newpass');
方法2:用mysqladmin
mysqladmin -u root password "newpass"
如果root已经设置过密码,采用如下方法
mysqladmin -u root password oldpass "newpass"
方法3: 用update直接编辑user表
mysql -u root mysql> use mysql; mysql> update user set password = password('newpass') where user = 'root'; mysql> flush privileges;
在丢失root密码的时候,可以这样
mysqld_safe --skip-grant-tables& mysql -u root mysql mysql> update user set password=password("new password") where user='root'; mysql> flush privileges;
以上所述是小编给大家介绍的mysql免安装版设置密码教程详解,希望对大家有所帮助