[Modify] Mysql database ---- MySQL user (root) password under Linux

Modified user are listed at root.
First, the original myql with root password;


method:
outside mysql systems, use mysqladmin
mysqladmin -u root -p password "test123"
the Enter password: Enter the old password] [

Method two:
by logging mysql system
-uroot--p MySQL
the enter password:] [enter the original password
MySQL> use MySQL;
MySQL>  Update User password SET pASSWORD = ( "Test") WHERE User = 'the root';
MySQL>  the flush privileges;
MySQL>  Exit;       



II. forget the original root password of myql;

first of all, you must have root access to the operating system. Even if the system root privileges are not, first consider the root system longer follow the steps below.
Similar to safe mode login system, it was suggested that a pkill MySQL , but I do not recommend Ha. Because when you execute this command, it will lead to such a situation:
/etc/init.d/mysqld Status
mysqld dead but subsys locked
so even if you are starting mysql in safe mode may not be useful, it is generally so /etc/init.d/mysqld stop , if you are unfortunate enough to use the pkill, then start it again stop slightly .
The mysqld_safe --skip-Grant-Tables &
&, showing in the background, the background is no longer running, a terminal would then open slightly.
Mysql
mysql>  use mysql;
mysql>  the UPDATE the SET password = User password ( "test123") the WHERE User = 'the root';   
mysql>  the flush privileges;
mysql>  Exit;                         
## originally mysql is not case sensitive, but this is the specific value of the modified mysql mysql database, to be noticed.

Guess you like

Origin blog.csdn.net/ningjiebing/article/details/89411380