Linux MySQL cracking root Password

Source: Internet
Author: User
Unixlinux 1: First stop mysqld, it is best to kill killallmysqld 2: Start mysql, but skip the permission table usrlocalmysqlbinmysqld_safe -- skip-grant-tables 3: Go to mysql, and change the password usrlocalmysqlbinmysql-urootmysqlusemysql; mysqlupd

Unix linux 1: First stop mysqld. It is best to killall mysqld 2: Start mysql, however, you must skip the permission table/usr/local/mysql/bin/mysqld_safe -- skip-grant-tables. Third, go to mysql, and change the password/usr/local/mysql/bin/mysql-u root mysqluse mysql; mysqlupd

Unix & linux
First, stop mysqld and kill it all.
Killall mysqld
Second, start mysql, but skip the permission table.
/Usr/local/mysql/bin/mysqld_safe -- skip-grant-tables &
Third, go to mysql and change the password.
/Usr/local/mysql/bin/mysql-u root
Mysql> use mysql;
Mysql> update user set password = password ("new_pass") where user = "root ";
Mysql> flush privileges;
Mysql> \ q
4. Restart mysql and enter normally.

Windows
First, go to the command line in the Windows window and stop the mysql service: net stop mysql
2. Go to the mysql installation directory and go to the bin directory.
Mysqld-nt.exe -- skip-grant-tables
Third, go to the mysql installation directory in another window and change the password:
Execute mysql.exe
> Use mysql;
> Update set user password = password ("new_pass") where user = "root ";
> Flush privileges;
> \ Q
4. End the mysqld-nt process and restart mysql.


In windows, if the above method cannot be solved, you can add the following line in the [MySQLd] configuration section of my. ini:
Skip-grant-tables

Save it, restart mysql, and use mysql-uroot to access the database as the root user.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.