简体   繁体   中英

MariaDB v 10: console login failure

I have installed MariaDB server:

$ mysql --version
mysql  Ver 15.1 Distrib 10.0.32-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

and have created new user 'alex':

> SELECT User, Host FROM mysql.user;
+------------------+-----------+
| User             | Host      |
+------------------+-----------+
| root             | 127.0.0.1 |
| root             | ::1       |
| alex             | localhost |
| debian-sys-maint | localhost |
| root             | localhost |
| root             | myhost    |
+------------------+-----------+

I can connect to the server as 'alex'@'localhost' using DBeaver client but I cannot do the same from console:

$ mysql -h localhost --user=alex --password=...
ERROR 1045 (28000): Access denied for user 'alex'@'localhost' (using password: YES)

I can connect as 'root' from console but not as 'alex'. Permissions are OK when I connected with DBeaver.

I can't reproduce the problem:

$ mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 44
Server version: 10.0.32-MariaDB mariadb.org binary distribution

MariaDB [(none)]> CREATE USER 'alex'@'localhost';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> SELECT `User`, `Host` FROM `mysql`.`user`;
+------------------+-----------+
| User             | Host      |
+------------------+-----------+
| root             | 127.0.0.1 |
| root             | ::1       |
| alex             | localhost |
| debian-sys-maint | localhost |
| root             | localhost |
| root             | myhost    |
+------------------+-----------+
6 rows in set (0.01 sec)

MariaDB [(none)]> exit
Bye

$ mysql -h localhost --user=alex --password
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 48
Server version: 10.0.32-MariaDB mariadb.org binary distribution

MariaDB [(none)]>

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