首頁 >資料庫 >mysql教程 >mysql修改用户密码_MySQL

mysql修改用户密码_MySQL

WBOY
WBOY原創
2016-06-02 08:49:531315瀏覽

登录root用户

用root用户登录控制台。

use mysql

use mysql,mysql是mysql数据库自动创建的一个数据库。

修改user表的数据

update user 
set password=PASSWORD('1234') 
where user='root';


刷新权限

FLUSH PRIVILEGES;


参考

修改mysql用户密码



附: 1、完整的命令行操作
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| ospm               |
| performance_schema |
| test               |
+--------------------+
5 rows in set (0.00 sec)

mysql> use mysql
Database changed
mysql> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| db                        |
| event                     |
| func                      |
| general_log               |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| host                      |
| ndb_binlog_index          |
| plugin                    |
| proc                      |
| procs_priv                |
| proxies_priv              |
| servers                   |
| slow_log                  |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
+---------------------------+
24 rows in set (0.00 sec)

mysql> 
update user 
set password=PASSWORD('1234') 
where user='root';

Query OK, 1 row affected (0.02 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql>

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn