Home Database Mysql Tutorial 不重启Mysql修改root密码的方法_MySQL

不重启Mysql修改root密码的方法_MySQL

Jun 01, 2016 pm 01:18 PM
forget the password database user account

bitsCN.com

一、一般忘记密码的解决办法,需要重启Mysql
1、skip-grant-tables
我们常用的方法是使用skip-grant-tables选项,mysqld server启动之后并不使用权限系统(privilege system)。用户不需要任何账号、不受任何限制的访问数据库中所有数据。为了安全起见,通常加上 skip-networking ,mysqld不侦听任何TCP/IP连接请求。操作过程如下,
1)修改my.cnf配置文件,在mysqld选项中添加skip-grant-tables和skip-networking。
2)再重启mysqld server。
3)通过sql语句修改mysql.user表中存储密码。执行flush privileges,重新启用mysql权限系统。
UPDATE mysql.USER SET Password=PASSWORD('newpwd')WHERE User='root';
FLUSH PRIVILEGES;
4)删除或者注释配置文件中skip-grant-tables和skip-networking的参数选项。如果使用skip-networking,则需要再次重启mysqld。因为skip-networking不是系统变量,只是mysqld的参数选项,而不能通过系统变量动态进行设置。如果没有适用skip-networking,只需要执行flush privileges就可以使权限系统重新生效。
2. --init-file
mysqld_safe可以使

Statement of this Website
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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How does Go language implement the addition, deletion, modification and query operations of the database? How does Go language implement the addition, deletion, modification and query operations of the database? Mar 27, 2024 pm 09:39 PM

How does Go language implement the addition, deletion, modification and query operations of the database?

How to retrieve Xiaohongshu account? What are the operating strategies for Xiaohongshu accounts? How to retrieve Xiaohongshu account? What are the operating strategies for Xiaohongshu accounts? Mar 27, 2024 pm 02:51 PM

How to retrieve Xiaohongshu account? What are the operating strategies for Xiaohongshu accounts?

How to turn Douyin Huoshan account into Douyin account How to turn Douyin Huoshan account into Douyin account Mar 27, 2024 pm 12:50 PM

How to turn Douyin Huoshan account into Douyin account

Detailed method of checking account on NetEase Cloud Detailed method of checking account on NetEase Cloud Mar 25, 2024 pm 12:41 PM

Detailed method of checking account on NetEase Cloud

I upgraded arise account registration by myself and shared graphic tutorials I upgraded arise account registration by myself and shared graphic tutorials Mar 28, 2024 pm 01:16 PM

I upgraded arise account registration by myself and shared graphic tutorials

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

Detailed tutorial on establishing a database connection using MySQLi in PHP

How does Hibernate implement polymorphic mapping? How does Hibernate implement polymorphic mapping? Apr 17, 2024 pm 12:09 PM

How does Hibernate implement polymorphic mapping?

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos

See all articles