why we need --skip-grant-tables in mysql to remove error 1045:access denied ?what does it really do?

StackOverflow https://stackoverflow.com/questions/22849308

  •  27-06-2023
  •  | 
  •  

why we need --skip-grant-tables to remove Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) Every where either for linux/unix or windows there is same error. can any one please explain it. And what does --skip-grant-tables really do? here is my code

import MySQLdb
db=MySQLdb.connect(host="localhost",
                   user="root",
                   passwd="********",
                   db="test")
有帮助吗?

解决方案 2

There must be conflict between your mysql password and password you uses in your application. You should not use --skip-grant-tables options as it will start your server without using the privilege system. It must be dangerous for you. Any one can access your account if you will use it.

其他提示

Straight from the MySQL Docs:

This option causes the server to start without using the privilege system at all, which gives anyone with access to the server unrestricted access to all databases. You can cause a running server to start using the grant tables again by executing mysqladmin flush-privileges or mysqladmin reload command from a system shell, or by issuing a MySQL FLUSH PRIVILEGES statement after connecting to the server. This option also suppresses loading of user-defined functions (UDFs).

Basically, this removes the Access Denied error by not checking the password, which is useful in a few cases (basically when instructed by the docs), such as when you are resetting your root password. However, this is not a solution to an Access Denied error. That would be like taking the lock off your door after discovering your house key doesn't work!

I think now i got it, here error is Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) so i just change my code as :

import MySQLdb
db=MySQLdb.connect("localhost","root",'',"test")

OR

import MySQLdb
db=MySQLdb.connect(host="localhost",
                   user="root",
                   passwd='',
                   db="test")

Here i set NULL password as error is Access denied for user using password yes

Now if anybody has any ques related to it please discuss ...thanks

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top