Modify the mysql root password under Linux, modify the mysql root password Linux

Mysql modify the Linux root password

 

Here are the steps

First, know the root password myql the original database;

1, the command line input terminal 

1
mysqladmin -u root -p password  "新密码"  回车 ,Enter password: 【输入原来的旧密码】

2, modify the system login mysql,  mysql-uroot--p  Enter Enter password: [Enter the old password]

1
2
3
4
5
6
7
mysql>use mysql;
 
mysql> update user  set  password=password( "新密码" where  user= 'root' ;      
 
mysql> flush privileges;
 
mysql> exit;

You can then log in using the new password you just typed.

Second, do not know the root password of the original myql;
first of all, you must have root access to the operating system.

Need to stop the mysql service, /etc/init.d/mysqld STOP

When prompted mysql has stopped the next step  

1
Shutting down MySQL. SUCCESS!

In command line input terminal

1
mysqld_safe --skip-grant-tables &         【登录mysql系统】

Enter mysql mysql login system

1
2
3
4
5
6
7
mysql> use mysql;
 
mysql> UPDATE user SET password=password( "新密码" ) WHERE user= 'root' ;      【密码注意大小写】
 
mysql> flush privileges;
 
mysql> exit;

Restart the mysql service

So that the new root password is set success.

Third, modify the root login privileges

When you modify a good root password is likely to happen

1
ERROR 1045 (28000): Access denied  for  user  'root' @ 'localhost'  ( using  password: YES)

This is due to insufficient root login privileges, specific changes as follows

Need to stop the mysql service, /etc/init.d/mysqld STOP

When prompted mysql has stopped the next step   

1
Shutting down MySQL. SUCCESS!

In command line input terminal

1
mysqld_safe --skip-grant-tables &         【登录mysql系统】

Enter mysql mysql login system

1
2
3
4
5
6
7
8
9
mysql>use mysql;
 
mysql>update user  set  host =  '%'  where  user =  'root' ;
 
mysql> select  host, user  from  user;
 
mysql> flush privileges;
 
mysql> exit;

Then restart the mysql service on it.

Here are the steps

First, know the root password myql the original database;

1, the command line input terminal 

1
mysqladmin -u root -p password  "新密码"  回车 ,Enter password: 【输入原来的旧密码】

2, modify the system login mysql,  mysql-uroot--p  Enter Enter password: [Enter the old password]

1
2
3
4
5
6
7
mysql>use mysql;
 
mysql> update user  set  password=password( "新密码" where  user= 'root' ;      
 
mysql> flush privileges;
 
mysql> exit;

You can then log in using the new password you just typed.

Second, do not know the root password of the original myql;
first of all, you must have root access to the operating system.

Need to stop the mysql service, /etc/init.d/mysqld STOP

When prompted mysql has stopped the next step  

1
Shutting down MySQL. SUCCESS!

In command line input terminal

1
mysqld_safe --skip-grant-tables &         【登录mysql系统】

Enter mysql mysql login system

1
2
3
4
5
6
7
mysql> use mysql;
 
mysql> UPDATE user SET password=password( "新密码" ) WHERE user= 'root' ;      【密码注意大小写】
 
mysql> flush privileges;
 
mysql> exit;

Restart the mysql service

So that the new root password is set success.

Third, modify the root login privileges

When you modify a good root password is likely to happen

1
ERROR 1045 (28000): Access denied  for  user  'root' @ 'localhost'  ( using  password: YES)

This is due to insufficient root login privileges, specific changes as follows

Need to stop the mysql service, /etc/init.d/mysqld STOP

When prompted mysql has stopped the next step   

1
Shutting down MySQL. SUCCESS!

In command line input terminal

1
mysqld_safe --skip-grant-tables &         【登录mysql系统】

Enter mysql mysql login system

1
2
3
4
5
6
7
8
9
mysql>use mysql;
 
mysql>update user  set  host =  '%'  where  user =  'root' ;
 
mysql> select  host, user  from  user;
 
mysql> flush privileges;
 
mysql> exit;

Then restart the mysql service on it.

First, know the root password myql the original database;

1, the command line input terminal 

1
mysqladmin -u root -p password  "新密码"  回车 ,Enter password: 【输入原来的旧密码】

2, modify the system login mysql,  mysql-uroot--p  Enter Enter password: [Enter the old password]

1
2
3
4
5
6
7
mysql>use mysql;
 
mysql> update user  set  password=password( "新密码" where  user= 'root' ;      
 
mysql> flush privileges;
 
mysql> exit;

You can then log in using the new password you just typed.

Second, do not know the root password of the original myql;
first of all, you must have root access to the operating system.

Need to stop the mysql service, /etc/init.d/mysqld STOP

When prompted mysql has stopped the next step  

1
Shutting down MySQL. SUCCESS!

In command line input terminal

1
mysqld_safe --skip-grant-tables &         【登录mysql系统】

Enter mysql mysql login system

1
2
3
4
5
6
7
mysql> use mysql;
 
mysql> UPDATE user SET password=password( "新密码" ) WHERE user= 'root' ;      【密码注意大小写】
 
mysql> flush privileges;
 
mysql> exit;

Restart the mysql service

So that the new root password is set success.

Third, modify the root login privileges

When you modify a good root password is likely to happen

1
ERROR 1045 (28000): Access denied  for  user  'root' @ 'localhost'  ( using  password: YES)

This is due to insufficient root login privileges, specific changes as follows

Need to stop the mysql service, /etc/init.d/mysqld STOP

When prompted mysql has stopped the next step   

1
Shutting down MySQL. SUCCESS!

In command line input terminal

1
mysqld_safe --skip-grant-tables &         【登录mysql系统】

Enter mysql mysql login system

1
2
3
4
5
6
7
8
9
mysql>use mysql;
 
mysql>update user  set  host =  '%'  where  user =  'root' ;
 
mysql> select  host, user  from  user;
 
mysql> flush privileges;
 
mysql> exit;

Then restart the mysql service on it.

Guess you like

Origin www.cnblogs.com/shigfdengys/p/12152508.html