


Detailed explanation of forgotten MySql login password and solutions to forgotten passwords (picture)
This article mainly introduces MySqlSolutions for forgotten login passwords and forgotten mysql The quick solution to the password is very good and has reference value. Friends who need it can refer to it
Method 1:
access control. Start the MySQL server with this command on the command line:
safe_mysqld --skip-grant-tables&
MySQL database as an administrator.
It should be noted that after changing the password, you must stop and restart the MySQL server for it to take effectMethod 2:
You can follow the steps below to reset the MySQL root password: 1. First, confirm that the server is in a safe state, that is, No one can connect to the MySQL database arbitrarily Because during the period of resetting the MySQL root password, the MySQL database is completely unprotected by a password, and other users can also log in and modify the MySQL database at will. Information. You can close MySQL's external port and stop Apache and all user processes to achieve a quasi-safe state. The safest state is to operate on the server's Console and unplug the network cable. #2. Modify MySQL login settings:# vi /etc/my.cnf
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock skip-name-resolve skip-grant-tables
# /etc/init.d/mysqld restart Stopping MySQL: [ OK ] Starting MySQL: [ OK ]

#
# /usr/bin/mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 to server version: 3.23.56 Type ‘help;' or ‘\h' for help. Type ‘\c' to clear the buffer. mysql> USE mysql ; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> UPDATE user SET Password = password ( ‘new-password' ) WHERE User = ‘root' ; Query OK, 0 rows affected (0.00 sec) Rows matched: 2 Changed: 0 Warnings: 0 mysql> flush privileges ; Query OK, 0 rows affected (0.01 sec) mysql> quit Bye

# vi /etc/my.cnf


6. Restart mysqld
# /etc/init.d/mysqld restart Stopping MySQL: [ OK ] Starting MySQL: [ OK ] windows
1. Log in to the system as the system administrator. .
2. Open cmd--net start to see if mysql is started. If it is started, stop net stop mysql.
3. My mysql is installed in d:\usr\local. \mysql4\bin. 4. Skip permission check and start mysql.
d:\usr\local\mysql4\bin\mysqld-nt –skip-grant-tables
5. Reopen cmd. Go to d:\usr\local\mysql4\bin:
d:\usr\local\mysql4\bin\mysqladmin -uroot flush-privileges password “newpassword”
d:\usr\local\mysql4\bin\mysqladmin -u root -p shutdown This prompts you to re-enter your password.
6. Net start mysql in cmd
7. Done.
# SET PASSWORD FOR 'some_user'@'some_host' = OLD_PASSWORD(‘newpwd'); # FLUSH PRIVILEGES;
3, Mysql database repair
myisamchk -r -q d:\mysql\data\latin1\*
r represents repair
q Represents fast
d:\mysql\data\latin1\*In the database*Represents all the files in it
Method three:
If you forget your MYSQL root password, you can restore it through the following process. 1. Send the kill command to mysqld server to shut down the mysqld server (not kill -9). The file storing the process ID is usually in the directory where the MYSQL database is located. kill `cat /mysql-data-directory/hostname.pid`
3. Use the `mysql -h hostname mysql' command to log in to the mysqld server, and use the grant command to change the password. You can also do this: `mysqladmin -h hostname -u user password 'new password''.
(In fact, you can also use use mysql; update user set password =password('yourpass') where user='root' to do it.)
4. Load the permission table: ` mysqladmin -h hostname flush-privileges' , or use the SQL command `FLUSH PRIVILEGES'. (Of course, you can also restart mysqld here.)
Method 4: (Be sure to back up first)
1, restart Install the same version of MySQL on another computer2, delete all the contents of \data\mysql in the MySQL installation directory on the computer that has forgotten the password (stop the MySQL service first) 3,Copy新装的电脑上MySQL安装目录中\data\mysql的全部内容 to 刚刚删除的目录中 4,启动MySQL服务 PS:下面看下Mysql忘记密码解决方案 解决方法如下: 1、终端中结束当前正在运行的MySQL进程。 2、用mysql安全模式运行并跳过权限验证。 3、ctrl+T重开一个终端以root身份登录mysql。 4、修改root用户口令。 注意:括号里的'root'就是新密码。 5、结束mysql安全模式,用正常模式运行mysql。 6、试试你新修改的口令登陆MySQL 输入密码 root 刷新账户后,退出。# sudo /etc/init.d/mysql stop
# sudo /usr/bin/mysqld_safe --skip-grant-tables
# mysql -u root
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set Password = PASSWORD('root') where User ='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> exit
# sudo /etc/init.d/mysql restart
#myslq -u root -p
mysql> show grants for 'root'@'127.0.0.1';
mysql> flush privileges;
mysql> quit;
The above is the detailed content of Detailed explanation of forgotten MySql login password and solutions to forgotten passwords (picture). For more information, please follow other related articles on the PHP Chinese website!

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

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

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.

I encountered a tricky problem when developing a small application: the need to quickly integrate a lightweight database operation library. After trying multiple libraries, I found that they either have too much functionality or are not very compatible. Eventually, I found minii/db, a simplified version based on Yii2 that solved my problem perfectly.

The key to installing MySQL elegantly is to add the official MySQL repository. The specific steps are as follows: Download the MySQL official GPG key to prevent phishing attacks. Add MySQL repository file: rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm Update yum repository cache: yum update installation MySQL: yum install mysql-server startup MySQL service: systemctl start mysqld set up booting

Installing MySQL on CentOS involves the following steps: Adding the appropriate MySQL yum source. Execute the yum install mysql-server command to install the MySQL server. Use the mysql_secure_installation command to make security settings, such as setting the root user password. Customize the MySQL configuration file as needed. Tune MySQL parameters and optimize databases for performance.

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.

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.
