ubuntu 超级管理员修改Mysql数据库密码

debian-sys-maint是个mysql安装之后自带的用户,具体作用是重启及运行mysql服务。

忘了root密码就该他大显身手了。

root@ms:/etc# cd mysql/
root@ms:/etc/mysql# vi debian.cnf

user     = debian-sys-maint
password = *******************************

把密码粘贴出来  用这个用户密码登录mysql

root@ms:/etc/mysql# mysql -u debian-sys-maint -p
Enter password:**********

登录进来:
 

mysql> use mysql

mysql> update user set password=password('新密码') where user='root';

报错了!
ERROR 1054 (42S22): Unknown column 'password' in 'field list'

别慌,很简单。
 

mysql> update user set authentication_string=password('新密码') where user='root';
Query OK, 0 rows affected, 1 warning (0.03 sec)
Rows matched: 1  Changed: 0  Warnings: 1

mysql> exit;
root@ms:/etc/mysql# mysql -u root -p
Enter password:刚才设置的密码

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.19-0ubuntu0.16.04.1 (Ubuntu)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值