You need to say ADD FOREIGN KEY, not just FOREIGN KEY. (See https://www.w3schools.com/mysql/mysql_foreignkey.asp). It will probably look like
ADD FOREIGN KEY
FOREIGN KEY
ALTER TABLE course ADD FOREIGN KEY (student_id) REFERENCES students(student_id);