Linux - Reset a MySQL root password
Use the following steps to reset a MySQL root password by using the command line interface.
Stop the MySQL service
(Ubuntu and Debian) Run the following command:
sudo /etc/init.d/mysql stop
(CentOS, Fedora, and Red Hat Enterprise Linux) Run the following command:
sudo /etc/init.d/mysqld stop
Start MySQL without a password
Run the following command. The ampersand (&) at the end of the command is required.
sudo mysqld_safe --skip-grant-tables &
Connect to MySQL
Run the following command:
mysql -uroot
Set a new MySQL root password
Run the following command:
use mysql;
update user set password=PASSWORD("mynewpassword") where User='root';
flush privileges;
quit
Stop and start the MySQL service
(Ubuntu and Debian) Run the following commands:
sudo /etc/init.d/mysql stop
...
sudo /etc/init.d/mysql start
(CentOS, Fedora, and Red Hat Enterprise Linux) Run the following commands:
sudo /etc/init.d/mysqld stop
...
sudo /etc/init.d/mysqld start
Log in to the database
Test the new password by logging in to the database.
mysql -u root -p
You are prompted for your new password.
Linux - Reset a MySQL root password的更多相关文章
- linux开机出现Give root password for maintenance (or type Control-D to continue):解决办法
修改rc.local后导致 linux开机出现Give root password for maintenance,而且很多系统文件无法修改,之前的rc.local也不能修改了,单用户模式也无法进入 ...
- 运维笔记--linux下忘记mysql root密码
补充链接:Windows下忘记密码处理: https://www.cnblogs.com/hellojesson/p/5972950.html 场景描述: Linux环境下忘记 root 密码, 1. ...
- mysql root password
"""centos:mysql忘记root密码解决 1.修改MySQL的登录设置: # vim /etc/my.cnf 在[mysqld]的段中加上一句:skip-gra ...
- linux下忘记mysql root密码解决办法
vi /etc/my.cnf #编辑文件,找到[mysqld],在下面添加一行skip-grant-tables [mysqld] skip-grant-tables :wq! #保存退出 s ...
- Linux下修改mysql root密码
1.修改MySQL的配置文件(默认为/etc/my.cnf),在[mysqld]下添加一行skip-grant-tables 2.保存配置文件后,重启MySQL服务 service mysqld re ...
- linux 下解决mysql root 权限无法远程连接问题
问题描述:MySQL数据库安装成功后,在服务器本地可以连接成功,但是使用工具navicat无法进行远程连接,如图: 原因:MySQL默认只允许root帐户在本地登录,如果要在其它机器上连接mysql, ...
- mysql forget root password
http://www.rackspace.com/knowledge_center/article/mysql-resetting-a-lost-mysql-root-password MySQL - ...
- linux 安装完mysql 密码重置
If you have forgot the MySQL root password, can’t remember or want to break in….. you can reset them ...
- Give root password for maintenance
linux开机出现"Give root password for maintenance (or type Control-D to continue):" 出现这种情况一般为两种 ...
随机推荐
- odoo10会计期间
从odoo9,会计模块重构之后,去掉了account.fiscalyear 以及 account.period 这两个模型, 但不表示 odoo 从此就没有 "会计年度"和&quo ...
- centos6.6安装mysql5.7.6(采用MySQL Yum Repository)—(先看最后一行)
在centos6.6系统上采用MySQL Yum Repository安装mysql5.7.6: 帮助文档:http://dev.mysql.com/doc/refman/5.7/en/linux-i ...
- 外部函数接口 LibFFI
“FFI” 的全名是 Foreign Function Interface,通常指的是允许以一种语言编写的代码调用另一种语言的代码.而 “Libffi” 库只提供了最底层的.与架构相关的.完整的”FF ...
- Linq to object 技巧、用法集锦
一.一个字符串,一个字符串数组.判断字符串数组里的元素出现在字符串中的有几个. class Program { static void Main(string[] args) { string str ...
- codility上的问题 (23)Chi 2012
这个题也比较有意思.意思是给定一个数组A,长度为M,里面都是正整数,代表每块地形的高度.现在要测试一种加农炮,给定一个炮弹的高度H, 如果存在最小的I,满足0 < I < M,满足A[I ...
- java解析网页的内容
有时候,我们需要在java程序中获取一个连接,然后解析连接后,获取连接返回的内容结果来解析.准确的说是解析一个链接. 以下代码时解析百度首页的链接,获取的html代码的效果: public stati ...
- 10g中注意谓词过滤的位置
在10g中当主查询的谓词信息,被错误的放入子查询中,会导致子查询无法展开 explain plan for UPDATE DWF.F_PTY_INDIV O SET END_DT = TO_DATE( ...
- Linux企业级项目实践之网络爬虫(21)——扩展为多任务爬虫
高效的网络爬虫是搜索引擎的重要基础.采用多任务并发执行,实现类似于CPU的流水线(pipeline)运行方式,可极大地提高网络和计算资源的利用率等性能. #include "threads. ...
- HDU 4444 Walk (离散化建图+BFS+记忆化搜索) 绝对经典
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=4444 题意:给你一些n个矩形,给你一个起点,一个终点,要你求从起点到终点最少需要转多少个弯 题解:因为 ...
- python filecmp标准库基础学习
# -*- coding: utf-8 -*-# 作者:新手__author__ = 'Administrator'#文件的比较import os,filecmp#作用用于比较系统中的目录和文件#例子 ...