您好:我用的MYSQL数据库是:5.0版本的,换了好几台机器都是提示这样的错误,请问怎么修改?
mysql> mysqladmin -uroot -p123456 password 123789;
ERROR 1064 (42000):You hava an error in your SQL syntax; check the manual that
correstponds to your MySQL server version for the right syntax to use newr 'mysql
admin -uroot -p123456 password 123789' at line 1
mysql> mysqladmin -uroot -p123456 password 123789;
ERROR 1064 (42000):You hava an error in your SQL syntax; check the manual that
correstponds to your MySQL server version for the right syntax to use newr 'mysql
admin -uroot -p123456 password 123789' at line 1
mysqladmin -uroot -p123456
因此不能在mysql>提示符下运行它。
而是在cmd命令行里执行。
至于命令格式,一点也没有错。
1,在cmd进到mysqladmin所在的目录,然后,mysqladmin -u root password 'newpassword'
这个立即生效,不需要重新启动服务器或刷新privilege表。
2,mysql>use mysql;
mysql> update user set Password=PASSWORD('newpassword') where User='root';
然后退出服务器,关闭服务器,重新启动就可以了。
mysql> update user set password=password('新密码') where user='root';
where user = 'root';flush privileges;