用户登录
用户注册

分享至

centos 7 mariadb密码

  • 作者: 愤怒的趣多多
  • 来源: 51数据库
  • 2020-09-27
1.登陆mysql或者mariadb(两种任选其一)

?

1
2

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

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

?

1
2
3

MariaDB [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

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

?

1
2
3
4

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

4.刷新用户权限列表

?

1
2

MariaDB [mysql]> flush privileges;回车
Query OK, 0 rows affected (0.00 sec)

5.退出mysql登陆

?

1
2

MariaDB [mysql]> quit
Bye

6.重启mysql或者mariadb服务

?

1
2

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



  我不会~~~但还是要微笑~~~:)
软件
前端设计
程序设计
Java相关