[trixbox1.localdomain ~]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 19
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
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
mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '’newpassword’) where USER=’root’' at line 1
mysql> update user set password=old_password('scf') where user='root' and host='localhost';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
本文介绍了一种通过MySQL命令行更新root用户密码的方法。演示了如何使用UPDATE语句更改root用户的密码,并强调了正确的语法格式。此外,还展示了如何刷新权限以便使更改生效。
2140

被折叠的 条评论
为什么被折叠?



