简体   繁体   中英

mysql: ERROR 1044 (42000) at line 41: Access denied for user

I'm facing a strange permission error with mysql.

When i try to upload a backup i get:

mysql DB -uDB -pPASS < files.30.12.12.sql
ERROR 1044 (42000) at line 41: Access denied for user 'DB'@'localhost' to database 'DB'

and what strange, using the same username and pass i can loging to mysql consul:

mysql DB -uDB -pPASS
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 51
Server version: 5.5.27-28.1 Percona Server (GPL), Release rel28.1, Revision 296

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Check that you can run that SQL file when you log in manually as well. I guess your SQL statement(s) are not executable by that specified user (-uDB). The error doesn't necessarily mean you are not logged into MySQL, it may well mean that you don't have the permissions to run the script

You can try login by executing a simple statement such as

mysql DB -uDB -pPASS < SHOW TABLES

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM