A.
First stop the service/etc/init.d/mysqld stop and add it in/ETC/MY.CNF:
Socket=/var/lib/mysql/mysql.sock
Skip-grant-tables
User=mysql
Start MySQL service, enter MySQL login
mysql> use MySQL;
Reading table information for completion of table and column names
Can turn off this feature to get a quicker startup with-a
Database changed
mysql> Update user Set Password=password (' Lixi ') where user= ' root ';
Query OK, 3 rows affected (0.02 sec)
Rows Matched:3 Changed:3 warnings:0
mysql> flush Privileges;
Query OK, 0 rows affected (0.01 sec)
Restart MySQL after modifying and then log in with your own modified password to OK
B. Source code installation mysql and password hack
[email protected]_168_2_193 ~]# cat/etc/issue
CentOS Release 6.4 (Final)
Kernel \ r on an \m
[Email protected]_168_2_193 ~]# uname-r
2.6.32-358.el6.x86_64
MySQL download wget http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.63.tar.gz
Tar xzf mysql-5.1.63.tar.gz; CD mysql-5.1.63;. /configure--prefix=/usr/local/mysql
--enable-assembler &&make-j8&&make-j8 Install
Configuring MySQL for System services
Cp/usr/local/mysql/share/mysql/my-medium.cnf/etc/my.cnf
Cp/usr/local/mysql/share/mysql/mysql.server/etc/rc.d/init.d/mysqld
Chkconfig--add mysqld
Chkconfig--level mysqld on
/etc/init.d/mysqld restart
Setting relevant parameters and initializing the database
Useradd MySQL
Chown-r Mysql.mysql/usr/local/mysql
/usr/local/mysql/bin/mysql_install_db--user=mysql--datadir=./var
--basedir=/usr/local/mysql/
Chown-r mysql.mysql var
/usr/local/mysql/bin/mysqld_safe--user=mysql &
/usr/local/mysql/bin/mysqld_safe--user=mysql--skip-grant-tables & Skip Permissions start background
/usr/local/mysql/bin/mysql Login Use Mysql;update user set Password=password (' Lixi ') where user= ' root '; flush privileges;/ Etc/init.d/mysqld restart
This article is from the "Fluffy Duck" blog, please be sure to keep this source http://woshitieren.blog.51cto.com/2466034/1672546
The method of MySQL password cracking under Linux