Forums

mySQL Error 2002

I have created a database, named LoginData and I am invoking mysql from the bash console as follows:

$ mysql -h davesedar.mysql.eu.pythonanywhere-services.com -u davesedar -p 'davesedar$LoginData'

this correctly opens mysql> I have created table Logins using (which appeared to work):

CREATE TABLE logins (id INT NOT NULL AUTO_INCREMENT, mydate DATE NOT NULL, mytime TIME NOT NULL, user_id VARCHAR(50) NOT NULL, user_name VARCHAR(50) NOT NULL, project VARCHAR(50) NOT NULL, PRIMARY KEY (id));

However when I try to load data from a CSV file:

LOAD DATA  INFILE "/home/davesedar/Apr-23.csv" INTO TABLE logins FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' IGNORE 1 ROWS (id, mydate, mytime, user_id, user_name) SET project = 'Admin';

MySQL does not request a password, but rather fails:

ERROR 1045 (28000): Access denied for user 'davesedar'@'%' (using password: YES)

I have read numerous similar posts, with answers, but none help

We have a help page for that.

Thank you pafk, I have read that Help Page many times and tried the MySQL line, however, it never prompts me for a password, I just get this response:

mysql -h davesedar.mysql.eu.pythonanywhere-services.com -u davesedar  'davesedar$LoginData' -p --local-infile=1
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 87460
Server version: 8.0.32 Source distribution
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
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>

does this status; response help?

mysql> status;
--------------
mysql  Ver 8.0.29-0ubuntu0.20.04.3 for Linux on x86_64 ((Ubuntu))
Connection id:          69978
Current database:       davesedar$LoginData
Current user:           davesedar@10.0.0.199
SSL:                    Cipher in use is TLS_AES_256_GCM_SHA384
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         8.0.32 Source distribution
Protocol version:       10
Connection:             davesedar.mysql.eu.pythonanywhere-services.com via TCP/IP
Server characterset:    utf8mb4
Db     characterset:    utf8mb4
Client characterset:    utf8mb4
Conn.  characterset:    utf8mb4
TCP port:               3306
Binary data as:         Hexadecimal
Uptime:                 21 days 6 hours 7 min 0 sec
Threads: 23  Questions: 2527283  Slow queries: 27  Opens: 8463  Flush tables: 3  Open tables: 3996  Queries per second avg: 1.376
--------------

Hi there -- could you post the exact command that you're using? The help page @pafk pointed to says to use "LOAD DATA LOCAL INFILE" instead of "LOAD DATA INFILE", but your example in your first post does not include the "LOCAL" keyword.

Thanks - all working now by including LOCAL

Excellent, thanks for confirming!