1 修改MySQL的登录设置


# vi /etc/my.cnf

在[mysqld]的中加上一句:skip-grant-tables 

2 重新启动mysqld


# /etc/init.d/mysqld restart 

Stopping MySQL: [ OK ]

Starting MySQL: [ OK ]

3 登录并修改MySQL的root密码


# /usr/bin/mysql 

Welcome to the MySQL monitor. Commands end with ; or \g. 

Your MySQL connection id is 3 to server version: 3.23.56 

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 ( 'new-password' ) WHERE User =
'root' ;
 

Query OK, 0 rows affected (0.00 sec) 

Rows matched: 2 Changed: 0 Warnings: 0 

mysql> flush privileges ; 

Query OK, 0 rows affected (0.01 sec) 

mysql> quit 

Bye

4 将MySQL的登录设置修改回来


# vi /etc/my.cnf 

将刚才在[mysqld]的段中加上的skip-grant-tables删除 

保存并且退出vi。

5 重新启动mysqld


# /etc/init.d/mysqld restart 

Stopping MySQL: [ OK ] 

Starting MySQL: [ OK ]

Work for fun,Live
for love!

最新文章

  1. 黄聪:C#类似Jquery的html解析类HtmlAgilityPack基础类介绍及运用
  2. Linux下man手册使用
  3. 举例讲解Linux系统下Python调用系统Shell的方法
  4. SQL触发器、事物
  5. Calendar类测试
  6. ngrok反向代理
  7. eclipse编辑jsp快捷键保存时特别卡的解决方法
  8. 为rm命令增加回收站功能
  9. PHP中::、->、self、$this操作符的区别
  10. HDU 4891 The Great Pan (模拟)
  11. C/C++语言中#的神奇作用:把宏参数字符串化/贴合宏参数
  12. WordPress 开放重定向漏洞
  13. Eclipse读取xml中文乱码问题解决
  14. python2.x 与 python3.x的不同
  15. linux压缩、解压缩和归档工具
  16. RNQOJ 21 FBI数
  17. Java SSM框架之MyBatis3(十)MyBatis批量插入数据(MySql)
  18. springboot-01 helloworld
  19. fastjson java类、字符串、jsonObject之前的转换
  20. U3D Transform用法

热门文章

  1. dubbo源码—service reference
  2. .net随笔--不好归类的
  3. Linux下SVN提交时强制写日志
  4. 微信小程序——获取openid
  5. phantomjs的使用
  6. Windows10 环境下安装 ElasticSearch
  7. Java string和各种格式互转 string转int int转string
  8. Hadoop(十五)MapReduce程序实例
  9. CTF---隐写术入门第一题 SB!SB!SB!
  10. [51nod1443]路径和树