mysql root 用户被删
[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 用户被删的更多相关文章
- 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 ...
- 禁止、允许MySQL root用户远程访问权限
关闭MySQL root用户远程访问权限: use mysql; update user set host = "localhost" where user = "roo ...
- Linux中Mysql root用户看不到mysql库问题解决方式
第一种方式: 1.首先停止MySQL服务:service mysqld stop2.加参数启动mysql:/usr/bin/mysqld_safe --skip-grant-tables & ...
- 无法给MySQL root用户修改密码的解决方法
本人编译安装完MySQL数据库,想给root用户修改密码,结果无法修改,并且报错,报错大概信息如下: mysqladmin: connect to server at 'localhost' fail ...
- centos误删mysql root用户找回办法
一天,我进入mysql后,查看所有用户 select host,user from mysql.user; 发现好多用户名, 太乱了,删除..... delete from user where us ...
- MySQL root用户忘记密码怎么办?修改密码方法:skip-grant-tables
忘记密码怎么办? 1.以管理员身份打开cmd2.执行命令tasklist |findstr mysql ,查看正在运行的mysql进程 3.执行命令taskkill /F /PID 13644(此处进 ...
- 【Mysql】Mysql root用户误删了或只剩下没有任何操作权限的用户怎么办
一.操作步骤 1.停止mysql服务:在mysql安装目录下找到mysqld.cnf:在mysqld.cnf中找到以下片段[mysqld]:另起一行加入代码:skip-grant-tables 并保 ...
- [mysql]root用户登录mysql,输入密码后报错:Access denied for user 'root'@'localhost'
问题如下: wangju-G4:~$ mysql -u root -p Enter password: ERROR (): Access denied for user 'root'@'localho ...
- mysql root用户登录后无法查看数据库全部表
可能是把root@localhost用户删掉了. 首先停掉mysql服务,在/etc/my.cnf中添加 skip-grant-tables,同时可以添加skip-networking选项来禁用网络功 ...
随机推荐
- 解决sqoop报错Invalid number; item = ITEM_UNICODE
报错栈: java.sql.SQLException: Invalid number; item = ITEM_UNICODE at com.intersys.jdbc.SysList.getInt( ...
- sonar使用故障Unable to load component class org.sonar.scanner.report.ActiveRulesPublisher/Unable to load component interface org.sonar.api.batch.rule.ActiveRules: NullPointerException
nginx后两个sonar负载分担 解决办法 Credit to @teryk-sonarsource-team, just making it an answer: Delete the direc ...
- go语言基础之运算符
一.运算符分类 1.1 算术运算符 运算符 术语 示例 结果 + 加 10 + 5 15 - 减 10 - 5 5 * 乘 10 * 5 50 / 除 10 / 5 2 % 取模(取余) 10 % 3 ...
- C#类的访问修饰符
默认情况下,类声明为内部的,即只有当前工程中的代码才能访问它.可以用internal访问修饰符关键字显式指定,但这不是必须的,类在定义时默认为此类型的类.但是C# 方法默认访问级别: private. ...
- java学习笔记8--接口总结
接着前面的学习: java学习笔记7--抽象类与抽象方法 java学习笔记6--类的继承.Object类 java学习笔记5--类的方法 java学习笔记4--对象的初始化与回收 java学习笔记3- ...
- TZOJ 1072: 编辑距离(动态规划)
1072: 编辑距离 时间限制(普通/Java):1000MS/10000MS 内存限制:65536KByte 总提交: 917 測试通过:275 描写叙述 如果字符串的 ...
- STM32 控制GSM模块收发信息 F407 discovery
main.c #include "stm32f4_discovery.h" #include <stdio.h> #define LED1_ON GPIO_SetBit ...
- RS报表设计采用Total汇总过滤出错
错误信息: DMR 子查询计划失败,并产生意外错误.: java.lang.NullPointerException 如图 原因是在RS过滤器中添加了: total([门诊人次] for [明细科室] ...
- 使用apache-cxf-2.2.10来制作一个极简版WebService程序
原想拿最新版cxf来制作的,无奈Apache的zip包总下不下来,国内的apache-cxf-2.2.10却一蹴而就,也就用了这个版本.下载地址是:http://pan.baidu.com/s/1td ...
- Qt 之 入门例程
以 “Hello Qt” 为例,介绍如何建立一个 Qt 工程 . 1 QLabel 例程 QLabel 用来显示文本和图片,它继承自 QFrame (而 QFrame 继承自 QWidget) 1. ...