Now I’m no MySQL pro, but I’ve been using it for a good 5-6 years and I’ve never come across this:
- I log into my server via SSH
- I log into MySQL via
mysql -u root -pSUPER_SECRET_PASSWORD - I write:
CREATE USER 'magical_username'@'locahost' IDENTIFIED BY 'super_magical_password';
Now this is where it gets weird. I expect the query to work and I can go about granting permissions, but, I get this instead:
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 'USER 'magical_username'@'localhost' IDENTIFIED BY 'super_magical_password' at line 1
Any ideas?
This isn’t really an answer but a solution to the problem:
It turns out that the magical sysadmin, in all his wisdom, thought it was a good idea to copy over MySQL’s raw DB files rather than doing a dump and import. This, coupled with incorrect permissions and MySQL versions, meant that MySQL had a big issue with users and granting, but serving the data was fine (that’s why it seemed really weird).
Long story short: rebuilt the box and imported the data the correct way 🙂