MySQL忘记密码的正确解决方法
以下的文章主要介绍的是MySQL忘记密码的正确解决方法,在实际操作中如果你忘记MySQL密码是一件很头痛的事情,这篇文章主要是介绍对MySQL忘记密码的补救方案,以下就有详细内容描述,望你会有所收获。 MySQL忘记密码解决方案: 破解本地密码: Windows: 1.用
以下的文章主要介绍的是MySQL忘记密码的正确解决方法,在实际操作中如果你忘记MySQL密码是一件很头痛的事情,这篇文章主要是介绍对MySQL忘记密码的补救方案,以下就有详细内容描述,望你会有所收获。
MySQL忘记密码解决方案:
破解本地密码:
Windows:
1.用系统管理员登陆系统。
2.停止MySQL的服务。
3.进入命令窗口,然后进入 MySQL的安装目录,比如我的安装目录是c:\mysql,进入C:\mysql\bin
4.跳过权限检查启动MySQL,
c:\mysql\bin>mysqld-nt ––skip-grant-tables
或则:c:\mysql\bin>mysqld ––skip-grant-tables
mysqld.exe是微软Windows MySQL server数据库服务器相关程序。mysqld-nt.exe是MySQL Daemon数据库服务相关程序。
MySQL忘记密码解决方案5.[未验证]
重新打开一个窗口
进入c:\mysql\bin目录,设置root的新密码
c:\mysql\bin>mysqladmin -u root flush-privileges password "newpassword"
c:\mysql\bin>mysqladmin -u root -p shutdown
将newpassword替换为你要用的root的密码,第二个命令会提示你输入新密码,重复第一个命令输入的密码。
5.[验证]或则:
重新开打一个命令提示符的窗口(CMD)
用空密码方式使用root用户登录 MySQL;
mysql -u root
修改root用户的密码;
<ol class="dp-xml"> <li class="alt"><span><span>mysql</span><span class="tag">></span><span> update mysql.user set </span><span class="attribute">password</span><span>=</span><span class="attribute-value">PASSWORD</span><span>('新密码') where </span><span class="attribute">User</span><span>=</span><span class="attribute-value">'root'</span><span>; </span></span></li> <li> <span>mysql</span><span class="tag">></span><span> flush privileges; </span> </li> <li class="alt"> <span>mysql</span><span class="tag">></span><span> quit </span> </li> </ol>
6.停止MySQL Server,用正常模式启动Mysql7.你可以用新的密码链接到Mysql 了。
Unix&Linux:
1.用root或者运行mysqld 的用户登录系统;
2.利用kill命令结束掉mysqld的进程;
3.使用–skip-grant-tables参数启动MySQL Server
shell>mysqld_safe –skip-grant-tables &
4.为root@localhost设置新密码
<ol class="dp-xml"><li class="alt"><span><span>shell</span><span class="tag">></span><span>mysqladmin -u root flush-privileges password "newpassword"</span></span></li></ol>
5.MySQL忘记密码解决方案重启MySQL Server
附录:
MySQL修改密码的方法大全:
<ol class="dp-xml"> <li class="alt"><span><span>mysql</span><span class="tag">></span><span> update user set </span><span class="attribute">Password</span><span>=</span><span class="attribute-value">password</span><span>('newpassword') where </span><span class="attribute">User</span><span>=</span><span class="attribute-value">'root'</span><span>; </span></span></li> <li> <span>mysql</span><span class="tag">></span><span> flush privileges; </span> </li> <li class="alt"><span>MYSQLADMIN -u root -p PASSWORD mypasswd </span></li> </ol>
可以修改MYSQL文件夹中的MY.INI文件
<ol class="dp-xml"> <li class="alt"><span><span>mysql</span><span class="tag">></span><span> SET PASSWORD FOR myuser@</span><span class="attribute">localhost</span><span> = </span><span class="attribute-value">PASSWORD</span><span>('mypasswd'); </span></span></li> <li> <span>mysql</span><span class="tag">></span><span> GRANT USAGE ON *.* TO myuser@localhost IDENTIFIED BY 'mypassword'; </span> </li> </ol>
以上的相关内容就是对MySQL忘记密码解决方案的介绍,望你能有所收获。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.

MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

Article summary: This article provides detailed step-by-step instructions to guide readers on how to easily install the Laravel framework. Laravel is a powerful PHP framework that speeds up the development process of web applications. This tutorial covers the installation process from system requirements to configuring databases and setting up routing. By following these steps, readers can quickly and efficiently lay a solid foundation for their Laravel project.

In MySQL, the function of foreign keys is to establish the relationship between tables and ensure the consistency and integrity of the data. Foreign keys maintain the effectiveness of data through reference integrity checks and cascading operations. Pay attention to performance optimization and avoid common errors when using them.

The main difference between MySQL and MariaDB is performance, functionality and license: 1. MySQL is developed by Oracle, and MariaDB is its fork. 2. MariaDB may perform better in high load environments. 3.MariaDB provides more storage engines and functions. 4.MySQL adopts a dual license, and MariaDB is completely open source. The existing infrastructure, performance requirements, functional requirements and license costs should be taken into account when choosing.

SQL is a standard language for managing relational databases, while MySQL is a database management system that uses SQL. SQL defines ways to interact with a database, including CRUD operations, while MySQL implements the SQL standard and provides additional features such as stored procedures and triggers.

MySQL and phpMyAdmin can be effectively managed through the following steps: 1. Create and delete database: Just click in phpMyAdmin to complete. 2. Manage tables: You can create tables, modify structures, and add indexes. 3. Data operation: Supports inserting, updating, deleting data and executing SQL queries. 4. Import and export data: Supports SQL, CSV, XML and other formats. 5. Optimization and monitoring: Use the OPTIMIZETABLE command to optimize tables and use query analyzers and monitoring tools to solve performance problems.
