mysql 修改密码

ubuntu 16

apt install mysql*

查看初始user和password
root@hecs-279155:~# cat /etc/mysql/debian.cnf 
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password = tvXfL92IdUcTEH8c

cent os7查看初始密码

systemctl start mysqld

grep "password" /var/log/mysqld.log

修改密码:
1使用命令
mysqladmin -uroot -pWp1@mysql.com password WP1@mysql.com

2使用数据库命令
mysql -uroot -p
set password for 用户名@localhost = password('新密码'); 一定不要忘记最后面的分号

3改数据库数据
1)、use mysql;                   #连接到mysql数据库

2)、update mysql.user set authentication_string=password('123456') where user='root' and Host ='localhost';    #修改密码123456是密码

3)、update user set  plugin="mysql_native_password";     

4)、flush privileges;

5)、quit; 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值