侧边栏壁纸
博主头像
小白博主等级

just do it!

  • 累计撰写 60 篇文章
  • 累计创建 77 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

Centos 7.2下修改MySQL指定用户密码

小白
2017-12-31 / 0 评论 / 0 点赞 / 105 阅读 / 186 字

使用用户账号密码登录MySQL

[root@localhost ~]# mysql -uroot -p

切换到存储用户名和密码的数据库

[mysql]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

修改密码,使用password()函数进行加密,实际上就是执行sql语句来更新指定用户的密码

[mysql]> update user set password=password('新密码') where user='要更新密码的用户名';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4  Changed: 4  Warnings: 0

刷新用户权限列表

[mysql]> flush privileges;

Query OK, 0 rows affected (0.00 sec)

退出mysql登陆

[mysql]> quit

Bye

重启mysql或者mariadb服务

[root@localhost ~]# service mysqld restart(重启mysql)

ps: 使用root用户

0

评论区