[root@M ~]# vi /etc/my.cnf
[mysqld]
skip-grant-tables
[root@M ~]# service mysqld restart
Shutting down MySQL... SUCCESS!
Starting MySQL.. SUCCESS!
mysql> insert into user(user,password,host) values ('root','','localhost');
mysql> update user set Host='localhost',select_priv='y', insert_priv='y',update_priv='y',delete_priv='y',create_priv='y',drop_priv='y',reload_priv='y',shutdown_priv='y',Process_priv='y',file_priv='y',grant_priv='y',References_priv='y',index_priv='y',create_user_priv='y',show_db_priv='y',super_priv='y',create_tmp_table_priv='y',Lock_tables_priv='y',execute_priv='y',repl_slave_priv='y',repl_client_priv='y',create_view_priv='y',show_view_priv='y',create_routine_priv='y',alter_routine_priv='y',create_user_priv='y' where user='root';
Query OK, 1 row affected (0.05 sec)
Rows matched: 1 Changed: 1 Warnings: 0
[root@M ~]# grep skip /etc/my.cnf
#skip-grant-tables
skip-external-locking
#skip-networking
slave-skip-errors = all
[root@M ~]# service mysqld restart
Shutting down MySQL.. SUCCESS!
Starting MySQL.. SUCCESS!
[root@M ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.40-log MySQL Community Server (GPL) Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.05 sec) mysql>
mysql> update user  set password=password("123") where 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)
[root@M ~]# mysql -uroot -p123
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.5.40-log MySQL Community Server (GPL) Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>

mysql root 用户被删的更多相关文章

  1. mysql root用户kill connection报ERROR 1095 (HY000): You are not owner of thread N

    今日某系统mysql root用户kill connection时报ERROR 1095 (HY000): You are not owner of thread N 按说通过root用户具有supe ...

  2. 禁止、允许MySQL root用户远程访问权限

    关闭MySQL root用户远程访问权限: use mysql; update user set host = "localhost" where user = "roo ...

  3. Linux中Mysql root用户看不到mysql库问题解决方式

    第一种方式: 1.首先停止MySQL服务:service mysqld stop2.加参数启动mysql:/usr/bin/mysqld_safe --skip-grant-tables &  ...

  4. 无法给MySQL root用户修改密码的解决方法

    本人编译安装完MySQL数据库,想给root用户修改密码,结果无法修改,并且报错,报错大概信息如下: mysqladmin: connect to server at 'localhost' fail ...

  5. centos误删mysql root用户找回办法

    一天,我进入mysql后,查看所有用户 select host,user from mysql.user; 发现好多用户名, 太乱了,删除..... delete from user where us ...

  6. MySQL root用户忘记密码怎么办?修改密码方法:skip-grant-tables

    忘记密码怎么办? 1.以管理员身份打开cmd2.执行命令tasklist |findstr mysql ,查看正在运行的mysql进程 3.执行命令taskkill /F /PID 13644(此处进 ...

  7. 【Mysql】Mysql root用户误删了或只剩下没有任何操作权限的用户怎么办

     一.操作步骤 1.停止mysql服务:在mysql安装目录下找到mysqld.cnf:在mysqld.cnf中找到以下片段[mysqld]:另起一行加入代码:skip-grant-tables 并保 ...

  8. [mysql]root用户登录mysql,输入密码后报错:Access denied for user 'root'@'localhost'

    问题如下: wangju-G4:~$ mysql -u root -p Enter password: ERROR (): Access denied for user 'root'@'localho ...

  9. mysql root用户登录后无法查看数据库全部表

    可能是把root@localhost用户删掉了. 首先停掉mysql服务,在/etc/my.cnf中添加 skip-grant-tables,同时可以添加skip-networking选项来禁用网络功 ...

随机推荐

  1. USACO ariprog 暴力枚举+剪枝

    /* ID:kevin_s1 PROG:ariprog LANG:C++ */ #include <iostream> #include <cstdio> #include & ...

  2. 使用Proxmark3进行MIFARE Classic卡的安全测试

    使用Proxmark3进行MIFARE Classic卡的安全测试   Proxmark3的MIFARE安全测试是很多朋友都非常重视的一部分,所以我们特地以这个部分进行介绍,告诉大家如何当你完成前期操 ...

  3. nmap常用扫描命令

    NMap,也就是Network Mapper,是Linux下的网络扫描和嗅探工具包. nmap是在网络安全渗透测试中经常会用到的强大的扫描器.功能之强大,不言而喻.下面介绍一下它的几种扫描命令.具体的 ...

  4. Node.js:EventEmitter类

    一.EventEmitter 类 Node.js 所有的异步 I/O 操作在完成时都会发送一个事件到事件队列. Node.js里面的许多对象都会分发事件:一个net.Server对象会在每次有新连接时 ...

  5. 算法导论-矩阵乘法-strassen算法

    目录 1.矩阵相乘的朴素算法 2.矩阵相乘的strassen算法 3.完整测试代码c++ 4.性能分析 5.参考资料 内容 1.矩阵相乘的朴素算法 T(n) = Θ(n3) 朴素矩阵相乘算法,思想明了 ...

  6. Hibernate 延迟载入

    一.延迟载入定义                 延迟载入,也叫懒载入,它是Hibernate为提高程序运行效率而提供的一种机制,即当仅仅有真正使用该对象的数据时才会创建. 说白了,所谓的延迟载入不是 ...

  7. Caused by: java.lang.NumberFormatException: For input string: &quot;&quot;

    1.错误描写叙述 java.lang.NumberFormatException: For input string: "" at java.lang.NumberFormatEx ...

  8. Could not find RubyGem cocoapods 错误

    之前安装过一次cocoapods 后来,安装octopress,安装过一次较新版的ruby,可能是由于ruby安装,把之前的cocoapods删除了,结果使用,出现如图错误 解决: 重新安装 coco ...

  9. 利用html5调用本地摄像头拍照上传图片[转]

    利用html5调用本地摄像头拍照上传图片   html5概念啥的就不废话了,不知道的 百度, 谷歌一堆..今天学了学html5中的Canvas结合新增的<video>标签来获取本地摄像头, ...

  10. [JS前端开发] js/jquery控制页面动态载入数据 滑动滚动栏自己主动载入事件

    本人小菜鸟一仅仅.为了自我学习和交流PHP(jquery,linux,lamp,shell,javascript,server)等一系列的知识,小菜鸟创建了一个群.希望光临本博客的人能够进来交流.寻求 ...