-D指定db登陆失败ERROR 1044 (42000): Access denied for user ‘lzldb‘@‘%‘ to database ‘lzldb‘

-D指定db登陆失败


#mysql -ulzl -p123456  -Dlzldb --socket=/my3456/mysql.sock               
Warning: Using a password on the command line interface can be insecure.
ERROR 1044 (42000): Access denied for user 'lzldb'@'%' to database 'lzldb'

困扰了很久,查了user没有问题。

原因很简单 -D参数要加到后面


#mysql -ulzl -p123456  --socket=/my3456/mysql.sock -Dlzldb
Warning: Using a password on the command line interface can be insecure.
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 200389
Server version: 5.7.26-log Source distribution

Copyright (c) 2000, 2014, 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.

mysql> select database();
+--------------+
| database()   |
+--------------+
| lzldb |
+--------------+
1 row in set (0.00 sec)

 

总结我已知的mysq参数问题:

1 mysql命令参数还是很敏感的,还是要注意参数顺序

2 -D参数尽量靠后

3 --defaults-file必须放在第一个参数

你可能感兴趣的:(MYSQL,BACKUP,mysql,ERROR,1044)