Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1497968
  • 博文数量: 329
  • 博客积分: 2773
  • 博客等级: 少校
  • 技术积分: 4219
  • 用 户 组: 普通用户
  • 注册时间: 2012-02-24 14:17
个人简介

淡定从容,宁静致远

文章分类

全部博文(329)

文章存档

2016年(4)

2015年(50)

2014年(68)

2013年(45)

2012年(162)

分类: SQLServer

2014-12-22 13:49:18

方法一、 
Js代码  
# /etc/init.d/mysqld stop  
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &  
# mysql -u root mysql   
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';   
mysql> FLUSH PRIVILEGES;   
mysql> quit  
# /etc/init.d/mysql restart  
# mysql -uroot -p   
Enter password: <输入新设的密码newpassword>   
mysql>  


方法二、 
Js代码  
直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码:  
# mysql -udebian-sys-maint -p   
Enter password: <输入[client]节的密码>   
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';   
mysql> FLUSH PRIVILEGES;   
mysql> quit  
# mysql -uroot -p   
Enter password: <输入新设的密码newpassword>   

mysql>  


支持远程访问:

mysql>use mysql;
mysql>update user set host = '%' where user = 'root';   --%可以改成ip或者其他
mysql>select host, user from user;    

重启数据库

阅读(5526) | 评论(0) | 转发(0) |
0

上一篇:linux MySQL安装

下一篇:强行重新修改密码

给主人留下些什么吧!~~