[分享]修改MySql的root用户的密码_MySQL, Oracle及数据库讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MySQL, Oracle及数据库讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 1645 | 回复: 0   主题: [分享]修改MySql的root用户的密码        下一篇 
wzj
注册用户
等级:新兵
经验:67
发帖:64
精华:0
注册:2011-11-15
状态:离线
发送短消息息给wzj 加好友    发送短消息息给wzj 发消息
发表于: IP:您无权察看 2014-12-8 10:01:02 | [全部帖] [楼主帖] 楼主

到WINDOWS的命令行了(‘DOS’ 下),切换到你的MySQL bin目录下。 比如我的是 C:\Program Files\MySQL\MySQL Server 5.1\bin 

然后敲下面的粗体的命令。注意你的my.ini位置。 

C:\Program Files\MySQL\MySQL Server 5.1\bin> mysqld  --defaults-file="C:\Program
Files\MySQL\MySQL Server 5.1\my.ini" --console --skip-grant-tables
090515 22:06:09 [Warning] The syntax '--log' is deprecated and will be removed i
n MySQL 7.0. Please use '--general_log'/'--general_log_file' instead.
090515 22:06:09 [Warning] The syntax '--log_slow_queries' is deprecated and will
be removed in MySQL 7.0. Please use '--slow_query_log'/'--slow_query_log_file'
instead.
090515 22:06:09 [Warning] The syntax '--log' is deprecated and will be removed i
n MySQL 7.0. Please use '--general_log'/'--general_log_file' instead.
090515 22:06:09 [Warning] The syntax '--log_slow_queries' is deprecated and will
be removed in MySQL 7.0. Please use '--slow_query_log'/'--slow_query_log_file'
instead.
090515 22:06:09 [ERROR] The update log is no longer supported by MySQL in versio
n 5.0 and above. It is replaced by the binary log. Now starting MySQL with --log
-bin='' instead.
090515 22:06:09  InnoDB: Started; log sequence number 0 324221
090515 22:06:09 [Note] mysqld: ready for connections.
Version: '5.1.33-community-log'  socket: ''  port: 3306  MySQL Community Server
(GPL)


看到这个结果就说明MySQL已经起来了。 

再开一个DOS窗口,同样切到mysql bin目录下, 

C:\Program Files\MySQL\MySQL Server 5.1\bin>mysql -uroot mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.33-community-log MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’;
mysql> FLUSH PRIVILEGES;
mysql> quit
C:\Program Files\MySQL\MySQL Server 5.1\bin> mysql -uroot -p
Enter password: <输入新设的密码newpassword>
mysql>


然后 

C:\Program Files\MySQL\MySQL Server 5.1\bin>mysqladmin shutdown


之后正常重启MySQL服务就行了。




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论