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):" 出现这种情况一般为两种 ...
随机推荐
- SQL建模错误--逗号分隔值
最近帮一个客户分析SQL语句的问题,大致经过如下 场景: 委托方有一个用于追踪他们产品的系统,每个产品都会卖给许多客户:但是客户又被从业务上分成两类,一类是带有合作伙伴性质的,这个 合作伙伴通常会给予 ...
- linux_grep
grep常用的命令行选项: 选项 说明 -c 只显示有多少行匹配,而不具体显示匹配的行. -h 不显示文件名. -i 在字符串比较的时候忽略大小写. -l 只显示包含匹配模板的行的文件名清单. -L ...
- Android学习之AndroidManifest.xml清单之<uses-feature>
无意之中看了几个小时的官方英文文档,关于<uses-feature>的介绍.有必要在这里记录一下,应该有很多人不知道<uses-feature>到底是做什么用的,因为我们平时根 ...
- FB是磁珠的符号
本文来自:http://www.coofish.org/post/FB-cizhu.html今天实验室一哥们研究DSP电路图,发现图中有一个符号是FB,外形有点像电阻(R),但是不清楚是什么电子元器件 ...
- C# 代码转换到Python
下载地址:http://pan.baidu.com/s/1dDAZJxv SharpDevelop 3.1 now supports converting C# and VB.NET code to ...
- UML--对象的介绍
UML相对于学习UML的符号含义而言,掌握它们背后的方法和思想是更为重要的.软件是一种实践知识,仅仅靠书本不可能成为高手.书本只能给出思路和知识点,而掌握和消化这些知识则必须在实践中去完成. 如果我们 ...
- BZOJ2045: 双亲数
2045: 双亲数 Time Limit: 10 Sec Memory Limit: 259 MBSubmit: 602 Solved: 275[Submit][Status] Descripti ...
- 【转】JAVA中的浅拷贝和深拷贝
原文网址:http://blog.bd17kaka.net/blog/2013/06/25/java-deep-copy/ JAVA中的浅拷贝和深拷贝(shallow copy and deep co ...
- jquery图片3D旋绕效果 rotate3Di的操作
这是一个图片效果,很简单实用,只需要一个"rotate3Di.js"的插件就行, 关于rotate的用法有如下几种: $(选择器).rotate3Di(30); //把图片3D旋转 ...
- PHP中获取文件扩展名
function get_extension($file) { return substr(strrchr($file, '.'), 1) ; } function get_extension($fi ...