标签:oca 后台 密码 ant grant comm www safe code
方法一:
登录mysql
mysql> set password for user@localhost = password(‘mypassword‘);
eg:
mysql>set password for zbxuser@localhost = password(‘zbxpass‘);
方法二:
登录mysql, 用 update 语句修改表
mysql>use mysql;
mysql>update user set password=password(‘mypassword‘) where cluase;
mysql>flush privileges;
或者
mysql>update mysql.user set password=password(‘mypassword‘) where cluase;
mysql>flush privileges;
eg:
mysql>user mysql;
mysql>update user set password=password(‘zbxpass‘) where user=‘zbxuser‘ and host=‘localhost‘;
mysql>flush privileges;
或者
mysql>update mysql.user set password=password(‘zbxpass‘) where user=‘zbxuser‘ and host=‘localhost‘;
mysql>flush privileges;
方法三:
用 mysqladmin 命令
mysqladmin -u用户名 -p旧密码 password 新密码
eg:
# mysqladmin -uzbxuser -pzbxpass password zbxpassnew;
如果忘记 mysql 的root 用户密码
先停止mysql服务
启动服务
mysqld_safe --skip-grant-tables & 跳过安全检查,并在后台执行
mysql -u root mysql
mysql>update user set password=password(‘root123‘) where user=‘root‘;
mysql>flush privileges;
参考:https://www.cnblogs.com/kyosusan/p/5198934.html
标签:oca 后台 密码 ant grant comm www safe code
原文地址:https://www.cnblogs.com/cncaptain/p/9636036.html