Can someone help me with this? I keep getting an error and I\'m typing it in jus
ID: 3870627 • Letter: C
Question
Can someone help me with this? I keep getting an error and I'm typing it in just the way I'm told. I'm using MySQL 5.7 Command Line Client.
Here is what I'm stuck on:
Enter a LOAD DATA statement that inserts records from the team_stats.txt fi le in your Projects directory for Chapter 7 into the teamstats table. Replace path_to_PHP_folders with the full path for your PHP_Projects directory for Chapter 7. mysql> LOAD DATA INFILE 'path_to_PHP_folders/ Chapter.07/Projects/team_stats.txt'[ENTER ] INTO TABLE teamstats;[ENTER ]
And here is what I typed:
mysql> LOAD DATE INFILE 'C:/Users/Desktop/PHP_Projects(1)/PHP_Projects/Chapter.07/Projects/team_stats.txt'
-> INTO TABLE teamstats;
And this is the error that I get:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DATE INFILE 'C:/Users/Desktop/PHP_Projects(1)/PHP_Projects/Chapter.07/Projects/t' at line 1
So I typed it in the same way but with back slashes instead of forward slashes (which is the way it's supposed to be but my teacher told me to try it the other way)...and this is the error I got:
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
Now I've tried looking this up online AND emailing my professor and neither have been very helpful. Can someone PLEASE tell me how to fix this? I don't have much time!!
Explanation / Answer
First of all you need to change your system files as fallow
Edit the For CentOS or linux = /etc/my.cnf file
For Windows = my.ini file
Add secure-file-priv = "" line at the end
Stop mysql service using systemctl stop MySQL
Restart it using systemctl start MySQL
It will now allow you to import and export the data.
if it wont work properly just replace "" to "/" in your file path.
It might help