Home >Database >Mysql Tutorial >mysql找还root密码

mysql找还root密码

WBOY
WBOYOriginal
2016-06-07 16:25:261001browse

mysql找回root密码 ==========================》修改root密码 1、关闭mysql服务 killall -TERM mysqld 2、修改配置文件 vi /etc/my.cnf 在[mysqld]的段中加上一句:skip-grant-tables 例如: [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.s

mysql找回root密码
==========================》修改root密码
1、关闭mysql服务
killall -TERM mysqld


2、修改配置文件
vi /etc/my.cnf


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


例如:


[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-grant-tables


3、重启mysqld
service mysqld restart


4、登录
mysql -uroot -p


5、修改密码
update mysql.user set password=PASSWORD('111111') where user='root';
flush privileges;//刷新权限


==========================》修改root密码
1、修改配置文件
 vi /etc/my.cnf
 去掉之前的改动


2、重启服务


3、设置远程用户
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn