- First stop the MySQL service
/etc/init.d/mysql stop
2. Then re-create a MySQL service with the Ignore Password Authentication mode
Return PID and other startup information after successful startup
[1] 3591Root@webserver:/Home/webmaster#121005 2: -: - [Note]Plugin'Federated' isdisabled.121005 2: -: -Innodb:the InnoDB Memory Heap isDisabled121005 2: -: -Innodb:mutexes andRw_locks UseGCC Atomic builtins121005 2: -: -innodb:compressed tables UseZlib1.2.3.4 121005 2: -: -Innodb:initializing buffer pool, size= -. 0M121005 2: -: -Innodb:completed initialization ofBuffer Pool121005 2: -: -Innodb:highest supportedfileFormat isBarracuda.121005 2: -: -Innodb:waiting forThe background threads toStart121005 2: -: -InnoDB:1.1.8StartedLogSequence Number 1595685 121005 2: -: - [Note]Mysqld:ready forconnections. Version:'5.5.24-0ubuntu0.12.04.1'Socket'/var/run/mysqld/mysqld.sock'Port0(Ubuntu)
3. Connect to the MySQL system library
4. After connecting to the MySQL library, directly modify the password of the root account to the new password ' 123456 '
Type'Help ;' or '\h' forHelp. Type'\c' toClear the Currentinput statement. mysql> Update User SetPassword=PASSWORD ('123456')where User='Root'; Query OK,3Rows Affected (0.00sec) Rows matched:3Changed:3Warnings:0MySQL>FLUSHPrivileges; MySQL>quit; Bye
5. Abort the MySQL service process
Kill 3591
6. Start the MySQL service normally and log in to the MySQL server with a new password
Service MySQL Start
MySQL Change root password