mysql 修改密码命令行

mysql 修改密码
方法:1

mysqladmin -u root password 'java-er.com'

方法:2
取消密码启动mysql

# vi /etc/my.cnf

在[mysqld]的段中加上一句:

skip-grant-tables

重启msyql
service mysqld stop
service mysqld start

mysql
 
UPDATE user SET authentication_string=PASSWORD('java-er.com') where USER='root';
 
alter user 'root'@'localhost' identified by 'java-er.com';  
 
set password=password("java-er.com");

成功以后将my.cnf里skip-grant-tables 注释,或者删除,重启mysql服务就好了。


This entry was posted in Linux, 数据库 and tagged , . Bookmark the permalink.
月小升QQ 2651044202, 技术交流QQ群 178491360
首发地址:月小升博客https://java-er.com/blog/mysql-update-passwd/
无特殊说明,文章均为月小升原创,欢迎转载,转载请注明本文地址,谢谢
您的评论是我写作的动力

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*

  

About Me

静水流深,水滴石穿