Advertisement
Guest User

Untitled

a guest
Nov 3rd, 2016
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. service mysqld stop
  2. service mysqld start --skip-grant-tables &
  3. mysql -u root
  4.  
  5. Access denied for user 'root'@'localhost' (using password: NO)
  6.  
  7. mysqladmin -u root password 'newpw'
  8.  
  9. UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
  10.  
  11. ERROR 1142 (42000): UPDATE command denied to user ''@'localhost' for table 'user'
  12.  
  13. Stop the mysql demon process using this command :
  14.  
  15. sudo /etc/init.d/mysql stop
  16.  
  17. Start the mysqld demon process using the --skip-grant-tables option with this command
  18.  
  19. sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &
  20.  
  21. start the mysql client process using this command
  22.  
  23. mysql -u root
  24.  
  25. from the mysql prompt execute this command to be able to change any password
  26.  
  27. FLUSH PRIVILEGES;
  28.  
  29. Then reset/update your password
  30.  
  31. SET PASSWORD FOR root@'localhost' = PASSWORD('password');
  32.  
  33. If you have a mysql root account that can connect from everywhere, you should also do:
  34.  
  35. UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root';
  36.  
  37. Alternate Method:
  38.  
  39. USE mysql
  40. UPDATE user SET Password = PASSWORD('newpwd')
  41. WHERE Host = 'localhost' AND User = 'root';
  42.  
  43. And if you have a root account that can access from everywhere:
  44.  
  45. USE mysql
  46. UPDATE user SET Password = PASSWORD('newpwd')
  47. WHERE Host = '%' AND User = 'root';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement