更改数据库登陆密码




登陆数据库,进入mysql数据库:


MariaDB [(none)]> 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 MariaDB [mysql]>
查看mysql数据库中user表: MariaDB
[mysql]> select user,host,password from user; +------+-----------+-------------------------------------------+ | user | host | password | +------+-----------+-------------------------------------------+ | root | localhost | *E56A114692FE0DE073F9A1DD68A00EEB9703F3F1 | +------+-----------+-------------------------------------------+ 1 row in set (0.00 sec)
更新user表中用户root对应的password字段: MariaDB
[mysql]> update user set password=password('123123') where user='root'; Query OK, 0 rows affected (0.02 sec) Rows matched: 1 Changed: 0 Warnings: 0 MariaDB [mysql]> select user,host,password from user; +------+-----------+-------------------------------------------+ | user | host | password | +------+-----------+-------------------------------------------+ | root | localhost | *E56A114692FE0DE073F9A1DD68A00EEB9703F3F1 | +------+-----------+-------------------------------------------+ 1 row in set (0.00 sec)
刷新权限:
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)


MariaDB [mysql]> 
原文地址:https://www.cnblogs.com/hui-shao/p/mysqladmin.html