ERROR 1045 (28000): Access denied for user 'test'@'localhost' (using password: NO)
By removing IDENTIFIED BY in CREATE USER no password is set
Code:
mysql> select user,host from mysql.user;
+------------------+------------+
| user | host |
+------------------+------------+
| root | 127.0.0.1 |
| root | ::1 |
| root | hppavilion |
| debian-sys-maint | localhost |
| root | localhost |
+------------------+------------+
6 rows in set (0.08 sec)
mysql> CREATE USER 'test'@'localhost';
Query OK, 1 rows affected (0.18 sec)
mysql> SHOW GRANTS FOR 'test'@'localhost';
+------------------------------------------+
| Grants for test@localhost |
+------------------------------------------+
| GRANT USAGE ON *.* TO 'test'@'localhost' |
+------------------------------------------+
1 row in set (0.05 sec)
mysql> GRANT ALL ON *.* TO 'test'@'localhost';
Query OK, 0 rows affected (0.18 sec)
mysql> SHOW GRANTS FOR 'test'@'localhost';
+---------------------------------------------------+
| Grants for test@localhost |
+---------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'test'@'localhost' |
+---------------------------------------------------+
1 row in set (0.00 sec)
restart mysql
programowanie.abedo.pl © 2025